It's easy to think that:

- If we count the overlapping times with each interval.
- Then, for each time we remove the interval with most overlapping interval(let's call it A)
- And we update the other intervals' overlapping time which is overlapped with A.
- When all interval has zero overlapping times, we get the result.

I know how to do it in greedy in O(nlgn) time, but I wonder why this cant work...

This idea failed in the last test case(that with 10k inputs).I can't figure out why... Can someone help me?please...?

Thanks your time for seeing these. Thank you~