← All problemsSign in

Shortest Routes II

CSESGraph AlgorithmsOpen on judge ↗

There are n cities and m roads between them. Your task is to process q queries where you have to determine the length of the shortest route between two given cities. Input The first input line has three integers n, m and q: the number of cities, roads, and queries. Then, there are m lines describing the roads. Each line has three integers a, b and c: there is a road between cities a and b whose

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.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start