Stuck on Easy Problem

I am not able to come up with a strategy to solve this problem.
https://www.codechef.com/problems/SEGDIR

The editorial is not given.
Given testcases do pass but gives error on submission. Since one hour, I have been trying but all in vain. Can someone give any strategy for this?
I know this is easy section problem but I am a beginner.
Thank you.

1 Like

Hey! Go to All Submissions and view a successful solution.

1 Like

I did that brother. The functions have been named such that I couldn’t quite understand what it was intended for. Now, I know. Thanks.

1 Like

I think you’d have figured what I’m going to say out, but here’s a hint anyway.
Note that the given time is HUGE. That means, no two segments can still intersect after this much time, unless they initially intersected AND had the same velocities and the same direction given to them (otherwise little by little they will slide apart and in such a long time they will not be intersecting anymore).

1 Like

Thank you! I got it. But, just to confirm if i really got it.
If two segments are coincident and have same velocities, we can give them opposite directions and get away with it.
But, if we have 3 segments or more, we cannot. Then we just print “No”.
Is this understanding correct?

1 Like

Yes, you are right.

1 Like