Under construction

Still being built. Things may change

uHunt

Time limit1sMemory limit128 MB

Summary
Process judge submissions in order and after each one report the leader's time and the submitter's rank by personal best, ignoring non-improving resubmissions.
Level

Medium4 of 10

Topics
Sorting, Hash map, Simulation
Solved
No attempts yet

Problem

uHunt is short for "UVa Hunting". It is a tool for the UVa online judge that keeps track of which problems you have solved and shows statistics together with a list of problems to try next.

My brother Felix Halim built the site. The UVa online judge has collected about 9 million submissions so far, roughly one every few seconds, along with about 3000 different problems and about 120000 users. Probably only a few thousand of them are active right now. My brother had to optimize the tool very hard so that every feature finishes "in an instant".

This problem covers one small piece of uHunt, the instant re-ranking of accepted submissions. One of the values the UVa online judge ranks is the running time an accepted program spends on the judge data and the judge machine. Take problem 100. Four accepted submissions already exist for it, ranked like this.

RankUserRunning time
1josh0.120
2nhahtdh0.127
3felix0.223
4steven0.323

Now user you submits accepted code for problem 100 and the judge measures 0.127 seconds. Then you takes the new rank 3, and felix and steven drop to rank 4 and rank 5. Even though you ties nhahtdh, nhahtdh set that time earlier and stays ahead.

RankUserRunning time
1josh0.120
2nhahtdh0.127
3you0.127
4felix0.223
5steven0.323

Suppose you is unhappy with rank 3 and rewrites the code for problem 100. The new version carries more implementation tricks and is judged at 0.115 seconds, so you takes rank 1 while josh and nhahtdh drop to rank 2 and rank 3. felix and steven keep rank 4 and rank 5.

RankUserRunning time
1you0.115
2josh0.120
3nhahtdh0.127
4felix0.223
5steven0.323

If another user grace submits accepted code for problem 100 with a running time of 3.475 seconds, the ranking becomes:

RankUserRunning time
1you0.115
2josh0.120
3nhahtdh0.127
4felix0.223
5steven0.323
6grace3.475

Suppose you tinkers some more and submits yet another accepted program for problem 100, judged at 0.121 seconds. That is slower than the personal best you already holds. The judge ignores such a submission, so the ranking stays exactly as in the table above.

Input

The first line contains nn (1≤n≤500001 \le n \le 50000), the number of submissions. The submissions are sorted by the time they were made, and you have to process them one after another in that order.

Each of the next nn lines contains problem_id, user_id and t, separated by single spaces. problem_id is a 3 digit integer from 100 to 199. user_id is a 4 digit integer from 0000 to 9999, padded with leading zeros. t is the running time of the accepted code that user user_id submitted for problem problem_id. It is written in the d.ddd format with exactly three digits after the decimal point and lies between 0.000 and 9.999. The time limit of every problem is under 10 seconds, so t never exceeds 9.999.

Output

Print one line as soon as you read each input line.

If the running time of that submission is slower than or equal to the best time the same user already holds on the same problem, print submission ignored and do not let the submission change the ranking.

Otherwise print five values separated by single spaces. The first three, problem_id, user_id and t, repeat the input in exactly the format it was given. The fourth value is the running time of the rank 1 coder on this problem once the submission is applied, and the fifth value is the rank of this user on this problem once the submission is applied. Write both running times in the d.ddd format.

Ranks come from sorting the users who hold accepted code on that problem by their personal best in increasing order. When two personal bests are equal, the submission that set the time earlier comes first.

Examples1

  1. Example 1

    Input
    12
    100 0000 0.120
    100 0001 0.323
    100 0002 0.223
    101 0000 9.999
    100 0003 0.127
    100 0004 0.127
    101 0001 9.998
    199 0000 7.777
    100 0004 0.115
    100 0005 3.475
    100 0004 0.121
    101 0001 9.998
    
    Expected output
    100 0000 0.120 0.120 1
    100 0001 0.323 0.120 2
    100 0002 0.223 0.120 2
    101 0000 9.999 9.999 1
    100 0003 0.127 0.120 2
    100 0004 0.127 0.120 3
    101 0001 9.998 9.998 1
    199 0000 7.777 7.777 1
    100 0004 0.115 0.115 1
    100 0005 3.475 0.115 6
    submission ignored
    submission ignored