← All problemsSign in

Good ranking

CodeChefRating 3134Open on judge ↗

The tennis tournament you organized has just finished and now you have to decide the ranking of the $N$ players (indexed by $1, 2, \dots, N$) who participated. Each pair of players played exactly one game and for each game you know who won (there are no draws in tennis). A ranking is a permutation $P_1, P_2, \dots, P_N$ of $1, 2, \dots, N$; where $P_1$ represents the winner of the tournament, $P_

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