Problem1382--最短路

1382: 最短路

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 0  Solved: 0
[Submit] [Status] [Web Board] [Creator:]

Description

给定 M 条边, N 个点的带权无向图。求 1 到 N 的最短路。

Input

第一行:N,M(N≤100000,M≤500000)

接下来M行3个正整数:ai,bi,ci表示ai,bi之间有一条长度为ci的路,ci≤1000。

Output

一个整数,表示 1 到 N 的最短距离。

Sample Input Copy

4 4
1 2 1
2 3 1
3 4 1
2 4 1

Sample Output Copy

2

Source/Category