CF2214E Shortest Paths
Description
You are given a graph of $ n $ nodes and $ m $ undirected edges. Find the [shortest path](https://en.wikipedia.org/wiki/Shortest_path_problem) from node $ 1 $ to each node with Dikjstra's algorithm.
Input Format
The first line contains two integers $ n $ and $ m $ $ (2 \leq n \leq 100, 0 \leq m \leq \frac{n(n-1)}{2}) $ .
The following $ m $ lines contain $ 3 $ integers each: $ u $ , $ v $ , and $ w $ , denoting an undirected edge from $ u $ to $ v $ with weight $ w $ $ (1 \leq u, v \leq n, 0 \leq w \leq 10^5) $ .
Output Format
Output the shortest path from node $ 1 $ to each node $ 2, \dots, n $ . If a node is not reachable from node $ 1 $ , output $ -1 $ .