← All problemsSign in

Curing Kingdom

CodeChefRating 3074Open on judge ↗

You are the ruler of a kingdom, and your cities have been infected with some mysterious disease! Formally, the kingdom may be represented as a graph with $N$ cities, conveniently labeled $1$ through $N$, and $M$ unweighted bidirectional roads between them. This graph is guaranteed to be connected, and it contains no self-loops or multiple edges. You would like to get rid of the infection. I

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