http://codeforces.com/contest/845/problem/C

can someone help me out with a explained solution.

In layman terms… It’s asking if there are more than two overlapping intervals at a single point… If more than 2 then answer is NO other wise all TV shows can be seen using 2 TVs.

This can be easily solved by sorting all numbers in all pairs of l,r of an interval. Then just traverse array and add 1 if arrival and subtract 1 on exit. A simple example can be found here…