← All problemsSign in

War with Westelande

In the world of Elder Tale, the Westelande Empire has $N$ cities, numbered from $1$ to $N$. These cities are connected through $N-1$ $\textbf{uni-directional}$, i.e. directed, Intercity Transport Gates such that all the cities are connected within the empire. The Kunie Clan can change the orientation of the Gates, but it will take $e[i]$ amount of gold to do so, where i$^{th}$ edge lies be

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