0% found this document useful (0 votes)
14 views3 pages

Standings en

The document provides information about an international informatics olympiad competition involving multiple teams solving problems. It explains the scoring system, which orders teams based on number of problems solved, total penalty points, number of first solves, and team number in case of ties. The input and output files are also described, with sample input showing team actions and sample output listing the final team ordering.

Uploaded by

delis.ug
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views3 pages

Standings en

The document provides information about an international informatics olympiad competition involving multiple teams solving problems. It explains the scoring system, which orders teams based on number of problems solved, total penalty points, number of first solves, and team number in case of ties. The input and output files are also described, with sample input showing team actions and sample output listing the final team ordering.

Uploaded by

delis.ug
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

International Informatics Olympiad in Teams – National Round Thursday 29th February, 2024

Problem Final Standings


Input file stdin
Output file stdout

After you helped kids form teams for IKPC (International Kindergarten Programming Contest),
you now want to know which team won the competition!
Your teacher provided you information regarding the number of teams, 𝑁 , the number of prob-
lems, 𝑃 , as well as the number of actions taken by the teams, 𝑄 .
For the 𝑖 𝑡ℎ action, you know the number of the team, 𝑡𝑖 , the problem number they submitted
on, 𝑝 𝑖 , as well as the verdict of the solution, 1 if the solution was accepted or 0 if the solution was
rejected. If team 𝑡𝑖 did not submit a correct solution before the 𝑖 𝑡ℎ action to that problem 𝑝 𝑖 ,
the penalty of the team corresponding to problem 𝑝 𝑖 is increased by 𝑖 . If a team submits multiple
solutions to a problem, the total penalty is increased by the sum of the penalties accumulated by
the time the first correct solution was submitted, including the first correct solution. However,
if a team never submits any correct solution to a problem 𝑝, the penalties accumulated for 𝑝
are NOT added towards the final penalty.
For example, if a team submits the following solutions on problem 1, they will get the total penalty
increased by 24, as only the submissions sent at times 5, 9 and 10 are considered. Take note that
the wrong solution at time 15 is not added to the total penalty.
• a wrong solution at time 5
• a wrong solution at time 9
• a correct solution at time 10
• a wrong solution at time 15
In order to simplify the competition, each action takes place at a different moment of time, thus
the 𝑖 𝑡ℎ action will take place in the 𝑖 𝑡ℎ minute. The moments of time are indexed from 1.
The final standings of the competition are decided as follows:
• First, the teams are ordered in non-ascending order of the number of problems they solved.
Warning, if the team submits more than a correct solution for the same problem, only the
first correct solution is counted.
• If two or more teams are tied, they will be ordered in non-descending order of their penal-
ties. Warning, in order to compute the penalty, we will consider the penalty accumulated
only among the problems which were solved, without considering the solutions sent after
the problem was solved, irrespective of the status of the solution.
• If they are still tied, they will be ordered in the non-ascending order of the number of first
solves they obtained. A first solve consists of a team being the first one to solve a certain
problem.
• If they are still tied, they will be ordered in increasing order of their team numbers (if two
teams have the exact same stats, the team with a smaller label goes first).
For example, if a team solved 10 problems and has a penalty of 190, it will be ahead of any team
who solved 9 problems or less, as well as ahead any team who solved 10 problems but with a penalty
greater than 190 or if they have the same penalty too, they will be ahead if they have more first
solves than the other team or the same number of first solves too but a smaller label.

1/3
International Informatics Olympiad in Teams – National Round Thursday 29th February, 2024

Input data
The first line of the input will contain the numbers 𝑁 , 𝑃 and 𝑄 , as stated above.
The next 𝑄 lines will each contain three values, 𝑡𝑖 , 𝑝 𝑖 and 𝑣𝑖 , where 𝑡𝑖 (1 ≤ 𝑡𝑖 ≤ 𝑁 ) is the number
of the team which had this action, 𝑝 𝑖 (1 ≤ 𝑝 𝑖 ≤ 𝑃 ) is the problem number they submitted on,
𝑣𝑖 is the verdict they got (0 for rejected and 1 for accepted).
Output data
The output will contain a single line, with the order of the teams, from the first placed team to
the last placed team, according to the restrictions specified in the statement.

Restrictions
• 1 ≤ 𝑁 , 𝑃 ≤ 100.
• 1 ≤ 𝑄 ≤ 104 .

# Points Restrictions
1 30 1 ≤ 𝑁 , 𝑃 ≤ 50
2 70 No further restrictions.

Examples
Input file Output file
7 11 17 4 2 6 3 1 5 7
5 3 0
4 11 1
2 5 1
3 9 1
2 11 1
7 7 0
6 1 1
4 2 1
6 11 1
4 9 1
5 5 0
1 4 1
2 2 1
2 6 0
6 10 1
3 8 1
3 5 1

Explanations
In the table below you can see the list of solved problems, penalty and first solves for each team

2/3
International Informatics Olympiad in Teams – National Round Thursday 29th February, 2024

Team Solved problems Penalty First solve count


4 3 20 2
2 3 21 1
6 3 31 2
3 3 37 2
1 1 12 1
5 0 0 0
7 0 0 0

3/3

You might also like