Ideal Scoreboard
Time limit2sMemory limit256 MB
Track contest solves in time order and report the interval during which every team and every problem has a solve but none has all.
- Level
Easy3 of 10
- Topics
- Simulation, Sorting
- Solved
- No attempts yet
Problem
Professor Boffin is the chief judge of an ICPC regional contest. He likes to watch the scoreboard and analyze it while the contest runs. He calls a scoreboard ideal when all four of these conditions hold at the same time.
- Every team has solved at least one problem.
- No team has solved every problem.
- Every problem has been solved by at least one team.
- No problem has been solved by every team.
The scoreboard is obviously not ideal when the contest starts, but it can become ideal while the contest runs. Once the scoreboard becomes ideal, it either keeps that state until the contest ends or loses the property partway through. It can be proved that the scoreboard never becomes ideal again after losing the property. Given the submission log of a contest, find the interval in which the scoreboard was ideal.
Input
The input holds several test cases. The first line of each test case has the number of teams , the number of problems , and the number of submissions , separated by spaces (, , ). Each of the next lines describes one submission with four space-separated values.
- teamID: the team number, an integer between and .
- problemID: the problem number, one of the first uppercase letters of the English alphabet.
- submission-time: the submission time in
HH:MM:SSformat, where all three parts have exactly two digits (, ). - result: the judgement, one of the following.
Yes: only this result means that the team solved the problem.No - Compilation Error: the submitted program failed to compile.No - Wrong Answer: the submitted program printed a wrong output.No - Run-time Error: the submitted program hit an error while running.No - Time Limit Exceeded: the submitted program did not finish within the time limit.No - Presentation Error: the output of the submitted program had a formatting error.
No two submissions share the same time. The submission lines are not necessarily given in time order. A team can leave another Yes submission on a problem it already solved, and such a submission does not change the scoreboard.
The last line of the input is 0 0 0, and that line is not a test case.
Output
For each test case, print the interval in which the scoreboard was ideal on one line. Write the interval as two times in the same HH:MM:SS format as the input. The first time is the moment the scoreboard becomes ideal, and the second time is the moment the scoreboard is no longer ideal. If the scoreboard stays ideal until the contest ends, print --:--:-- as the second time. If the scoreboard never becomes ideal during the contest, print --:--:-- for both times.