Problem D: 最短路
Memory Limit:512 MB
Time Limit:2.000 S
Judge Style:Text Compare
Creator:
Submit:26
Solved:20
Description
Input
输入第一行包含2个正整数N,M
第2到M+1行每行包含三个正整数u,v,w 表示u,v之间存在一条距离为w的路。
1<=N<=3e5
1<=M<=1e6
1<=u,v<=N
0<=w<=1e9
第2到M+1行每行包含三个正整数u,v,w 表示u,v之间存在一条距离为w的路。
1<=N<=3e5
1<=M<=1e6
1<=u,v<=N
0<=w<=1e9
Output
输出仅一行,共N个数,分别表示从皇宫到编号为1~N建筑的最短距离,两两之间用空格隔开。(如果无法到达则输出-1)
Sample Input Copy
3 3
1 2 1
1 3 5
2 3 2
Sample Output Copy
0 1 3