Graph 1, 1/2, 1/3, 1/4
Medium
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Given connected, directed graph with edge weights 1, 1/2, 1/3, 1/4. Find the shortest path from vertex 1 to all others.
Input
The first line contains two integers n and m (1 ≤ n ≤ 10^6
, 1 ≤ m ≤ 8 *10^5
) - the number of vertices and edges in a graph. The edges are given on separate lines. The edges are given with three integers: u, v и w (1 ≤ u, v ≤ n, u ≤ v, 1 ≤ w ≤ 4), meaning the directed edge from u to v with weight 1/w.
Output
For each vertex from 2 to n print one number - the length of the shortest path from vertex 1 to it with no less than 8 digits after the decimal point.
Examples
Input #1
Answer #1
Submissions 1K
Acceptance rate 12%