← All problemsSign in

They are COMING

CodeChefRating 2579Open on judge ↗

The **White Walkers** are coming. The Winterfell is the first place to be attacked by the Night King and his army of the dead. Jon Snow with Khaleesi has to take some important decisions to minimize the damage from the White Walkers. Winterfell can be denoted as a graph with $N$ nodes. There are $M$ roads each connecting 2 nodes - $A_i$ and $B_i$. The road is **directed from node

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