Lights Camera Mayhem!
All submissions for this problem are available.
For a long time you have been wanting to attend Waves and it is time for Lights, Camera, Mayhem! There are a lot of events taking place and you want to attend them all. Unfortunately, you might not be able to do that since some of them may take place at the same time. You have also decided that if you attend an event you want to stay for the whole duration of that event.
You decide that while you may not be able to attend them all, you will attend as many as you can. Given the schedule, try out figure out how many events that is.
NOTE: It will take you some time to get from one event to another, so if there are two events such that one ends exactly when another begins, you can not attend them both.
The first line will contain an integer T, denoting the number of test cases.
Each test case contains several lines.
The first line of each test case will contain an integer N, denoting the number of events.
The next N lines, one for each event, contain two space separated integers, starttime and endtime.
1 <= T <= 10
1 <= N <= 10000
0 <= starttime < endtime <= 1000000000
For each test case, output a single integer denoting the maximal number of events that you can attend.
In the first case you can attend events (0, 2), (3, 4), (5, 6)
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS|
Fetching successful submissions