#include<scoring>
InterviewTime limit2sMemory limit512 MB
Rank n contestants by problems solved, penalty, and last submission time, then assign each a base score from a 30-rank table, averaging ties and adding an on-site bonus.
- Level
Medium4 of 10
- Topics
- Sorting, Implementation, Math
- Solved
- No attempts yet
Problem
As you may know, LTH Challenge is part of a series of seven competitions called the Swedish Coding Cup. Each contest in the series gives the contestants a number of points depending on how well they place in the contest.
After each contest, scores are assigned according to the following table:
If a contestant gets a worse rank than , they get points.
If two or more contestants get the same rank in the contest, they are instead assigned the average score of all the corresponding ranks. This score is always rounded up to the closest integer. For example, if three contestants share the second place they all receive points.
Contestants may participate in every contest either on-site or online. If they compete on-site, they get one extra point, no matter their original score. If a contestant does not participate in a contest, they are assigned a score of .
At LTH Challenge, the rank of each contestant is computed using what is called ACM scoring. Each contestant is ranked first on the number of problems they solve (in descending order), secondly on their time penalty (in ascending order) and finally the time at which they submitted their last accepted solution in minutes (in ascending order). If all these three properties are equal, the contestants are tied.
As you may understand, it is really tedious to compute the scores of all the contestants after such a contest. The jury does not really want to program this themselves; they prefer to just use some existing library instead. However, it turns out that since this is the first time the Swedish Coding Cup is held, nobody had written such a library!
Fortunately, they have you.
Input
The input consists of:
- one line with the integer (), the number of contestants.
- lines with the integers , , and , (, , , ) -- the number of problems solved by a contestant, the time penalty of the contestant, the time at which they submitted their last accepted solution and the number of extra points the contestant should get due to competing on-site.
Output
Output lines containing the scores of all the contestants in the order they were listed in the input.