Problem: spoj.com/problems/MSE06H/en/1
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.

  • created

    Nov '14
  • last reply

    Dec '14
  • 1

    reply

  • 308

    views

  • 2

    users

  • 1

    link

24 days later

Draw a couple of complex test cases on a piece of paper. Now look at it and think while your brain automatically solves it. What did your eyes do?

This is a very useful concept to learn smile

Please post back if you have more questions.

Suggested Topics

Topic Category Replies Views Activity
C and C++ 0 22 13d

Want to read more? Browse other topics in C and C++ or view latest topics.