Destroying Roads
CodeChefOpen on judge ↗
In Turing Land there are exactly $n$ cities and $m$ bidirectional roads connecting the cities. Cities are numbered with integers from $1$ to $n$. If cities $a$ and $b$ are connected by a road, then in a minute you can go along this road either from city $a$ to city $b$, or from city $b$ to city $a$. The road network is such that from any city you can get to any other one by moving along the roads.
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