← All problemsSign in

City Shortcuts

Problem statement In the Byteland there are N cities, numbered 0 through N-1. The road network in the country forms an undirected connected graph. In other words: Some pairs of cities are connected by bidirectional roads. And all cities are connected to all other cities directly or indirectly. You are given a matrix MAP that describes the road network. For each i and j, MAP[i][j] is "Y" if the ci

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