The New King
CodeChefOpen on judge ↗
You are the new "King in the North!". The North is divided into $N$ regions and each region has a ruler. These rulers of each region are numbered from $1$ to $N$. Initially these rulers were in no way together. As allies are always needed, there happens $Q$ meets, in which any 2 rulers meet, and every meet results in both the rulers becoming allies which are **real edges**. Here, note that 2 ruler
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