Shortest Path
CodeChefOpen on judge ↗
You are given a weighted undirected graph. The vertices are enumerated from 1 to $n$. Your task is to find the shortest path between vertex 1 and vertex $n$. ### Input - The first line contains two integers $n$ and $m$ $(2 ≤ n ≤ 10^5, 0 ≤ m ≤ 10^5)$, where $n$ is the number of vertices and $m$ is the number of edges. - Following $m$ lines contain one edge each in form $a_i, b_i$ and $w_i$ $(1 ≤
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start