#abc375g. G - Road Blocked 2
G - Road Blocked 2
Score : points
问题陈述
在AtCoder国家,有编号为到的个城市,以及编号为到的条道路。 第条道路双向连接城市和,长度为。
对于每个,确定以下两个值是否不同。
- 当所有道路都可通行时,从城市到城市的最短距离
- 当除了第条道路外其他条道路都可通行时,从城市到城市的最短距离
如果城市在这两种情况中的一种可以被城市到达,但在另一种情况中不能到达,则认为这两个值是不同的。
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
In the nation of AtCoder, there are cities numbered to , and roads numbered to .
Road connects cities and bidirectionally and has a length of .
For each , determine whether the following two values are different.
- The shortest distance from city to city when all roads are passable
- The shortest distance from city to city when the roads other than road are passable
If city can be reached from city in one of these cases but not the other, the two values are considered different.
Constraints
- All pairs are distinct.
- City can be reached from city when all roads are passable.
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Print lines. The -th line should contain Yes
if the shortest distance from city to city when all roads are passable is different from the shortest distance when the roads other than road are passable, and No
otherwise.
If city can be reached from city in one of these cases but not the other, the two values are considered different.
Sample Input 1
3 3
1 2 5
1 3 10
2 3 6
Sample Output 1
No
Yes
No
When all roads are passable, the shortest distance from city to city is .
- When the two roads other than road are passable, the shortest distance is .
- When the two roads other than road are passable, the shortest distance is .
- When the two roads other than road are passable, the shortest distance is .
Sample Input 2
4 6
2 3 1
2 4 1
3 4 1
1 2 1
1 3 1
1 4 1
Sample Output 2
No
No
No
No
No
Yes
When all roads are passable, the shortest distance from city to city is .
When the five roads other than road are passable, the shortest distance is .
Sample Input 3
2 1
1 2 1
Sample Output 3
Yes
When the zero roads other than road are passable, city cannot be reached from city .