Problem: spoj.com/problems/MSE06H/en/
I tried to solve it using Brute force, but I got TLE.
Here's my approach :
If the two roads are of the form (x,y) and (a,b) then these roads will be counted once iff :
x < a && y > b (or) x > a && y < b
How do I proceed to get an AC? How do I optimize the above procedure to get an AC?
Thanks in advance.