BUSYMAN - I AM VERY BUSY
I AM VERY BUSY
You are actually very busy man. You have a big schedule of activities. Your aim is to do as much as activities as possible.
In the given figure, if you go to date with crush, you cannot participate in the coding contest and you can’t watch the movie. Also if you play DotA, you can’t study for the exam. If you study for the exam you can’t sleep peacefully. The maximum number of activities that you can do for this schedule is 3.
Either you can
- watch movie, play DotA and sleep peacefully (or)
- date with crush, play DotA and sleep peacefully
The first line consists of an integer T, the number of test cases. For each test case the first line consists of an integer N, the number of activities. Then the next N lines contains two integers m and n, the start and end time of each activity.
For each test case find the maximum number of activities that you can do.
1 <= T <=10
1 <= N <= 100000
0 <= start < end <= 1000000
Sample Input: (empty lines just for clarity) 3 3 3 9 2 8 6 9 4 1 7 5 8 7 8 1 8 6 7 9 0 10 4 5 8 9 4 10 5 7 Sample Output: 1 2 3
TLE using Python 3, sadness about Python :(
i do ont know why i am getting runtime error (sigsegv) besides the code achieving output in online compiler of c++ 14
Prefer sleeping than dating a crush lol :\
I'm getting a WA and I'm not sure why? It seems to be working fine when I type in the above test case(without the empty lines of course). Any help would be much appreciated.Last edit: 2018-08-30 16:15:26
it is not as simple as it looks if you are first time encountering such problem, costed 2 WA before AC :(Last edit: 2018-08-28 13:44:28
Last edit: 2018-08-27 20:23:30
Got AC.. But most importantly learnt the problem with Python. The same implementation in Python using the library function took >28M memory and got TLE.
Can anyone help me, I'm getting TLE error. https://ideone.com/eGxOs9