Time Limit: 10000/5000 MS (Java/Others)

Memory Limit: 32768/32768 K (Java/Others)

Mike loves the olympic games. What he hates about olympic games – besides them taking place only once every four years – is that the individual events are scheduled concurrently. That way it is never possible to watch all competitions live. Mike always tries to plan his personal schedule in order to maximize the number of events he can attend to. However, at the end he is never sure whether or not his schedule actually is optimal. Help him!

Given the days and times on which events take place, determine the maximum number of events Mike can watch. Mike never leaves during an event, so it is not possible to partially attend to events.

Given the days and times on which events take place, determine the maximum number of events Mike can watch. Mike never leaves during an event, so it is not possible to partially attend to events.

The input starts with a line containing a single integer n, the number of test cases.

Each test case starts with a line containing an integer 1 <= m <= 50000 that specifies the number of different events. The next m lines describe one event with three integers d, s, e. The event takes place on day d of the olympics, it starts at s and it ends at e, where the times are given in the form hhmm. All events are assumed to conclude the same day they started.

Each test case starts with a line containing an integer 1 <= m <= 50000 that specifies the number of different events. The next m lines describe one event with three integers d, s, e. The event takes place on day d of the olympics, it starts at s and it ends at e, where the times are given in the form hhmm. All events are assumed to conclude the same day they started.

The output for every test case begins with a line containing “Scenario #i:”, where i is the number of the test case counting from 1. Then, output a single line containing the number of events Mike can attend to at most. The time for getting from one event to another can be neglected. Events starting at time t can be scheduled after events ending at t as long as there are no other conflicts. Terminate each test case with an empty line.

提交代码