Mad King
CodeChefOpen on judge ↗
There are n different locations (0 to n-1) connected by n-1 bidirectional roads forming a connected tree.There are m different troops present at these locations such that more than one troop can be present at single location and some locations can be empty without any troop.Because of the orders of the Mad king, all the troops have to change their locations which is given by the following function
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