← All problemsSign in

Roads

Given a weighted, undirected graph G of n vertices and m edges, we say that there is a road from vertex A to vertex B if for a given value r, there exists at least one path from A to B such that the minimum weight edge on the path is at least r. You would be given q queries, each of them is a value of r. For each query, output a single integer, the number of distinct, un-ordered pair of vertice

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