← November 2025 questions

NOVEMBER 2025 / ADVANCED / QUESTION 8

Question 8

Archived question

Try the question in your own editor, then check your output below.

THE QUESTION

Text from the official booklet. Refer to the PDF for original mathematical notation, formatting, and linked input files. Printed samples and inputs are reproduced as published.

To defend Earth from an impending robot invasion, the human resistance has recruited
a team of elite pilots to control specialized combat drones. The commander is tasked
with assessing the pilots’ skills during a series of simulated battles.
In each of K simulation rounds (1 ≤ K ≤ 10), the commander ranks the N pilots
according to their drone-handling performance (1 ≤ N ≤ 20). After all simulations, the
commander wishes to analyze the consistency of the results.
A pair of two distinct pilots ( A, B) is considered consistent if the same pilot always
ranks higher than the other in every single simulation round.
Task
Determine how many consistent pilot pairs exist after all simulations.
Input Format
• The first line contains two integers K and N .
• The next K lines each contain the integers 1 . . . Nin some order, representing the
rankings for that simulation.
• If pilot A appears before pilot B in a ranking, then A outperformed B in that
round.
Output Format
Output a single integer: the total number of consistent pilot pairs.
Sample Input
3 4
4 1 2 3
4 1 3 2
4 2 1 3
Sample Output
4
Question Input
10 20
8 14 10 5 20 13 1 11 7 3 2 15 4 18 19 9 17 12 16 6
13 3 12 5 20 1 16 11 2 9 17 8 4 15 19 14 7 10 18 6
8 18 12 5 20 13 10 11 17 7 2 15 4 16 19 1 9 14 3 6
8 14 3 19 20 13 10 11 1 9 7 15 2 16 5 12 4 17 18 6
14 3 12 5 20 13 10 18 17 9 19 15 1 16 2 11 7 8 4 6
8 3 4 5 10 11 13 15 17 9 2 20 19 16 12 14 7 1 18 6
8 3 12 20 15 13 10 4 17 9 2 5 11 14 19 6 7 1 18 16
5 3 12 8 1 13 10 11 16 17 2 15 4 9 6 19 7 20 18 14
8 3 4 5 20 13 18 11 12 6 2 15 7 9 19 14 17 1 10 16
8 3 12 16 20 13 10 1 4 9 2 14 17 6 19 15 7 18 11 5

CHECK YOUR ANSWER

Try your answer.

Run your program in your own editor, then paste its output below. This checks the stated output; it does not assess your full program. Practice attempts do not affect competition scores.

Use the question input above. Enter only the output.

Reveal worked answer

Your output

10

Consider each unordered pair once, using its order in the first round. Count it only if that same order holds in all ten rounds.

Source: Girls in Code SEA 2025 Fall Competition, 29 November 2025. Booklet created by Emily Xu and the GIC question authors. Shared for non-commercial educational use with attribution, as permitted in the booklet.