SAMESNAK - Editorial

@the_king_i_am ,the answer should be no in the test case given by you. And mine is also printing yes.

Thanks for the concern.

@the_king_i_am ,the answer should be no in the test case given by you. And mine is also printing yes.

Thanks for the concern.

A possible solution would be to make these checks

  1. one of the endpoints overlap
  2. the two snakes are parallel and
  3. one of the snakes has an endpoint lying on the other

if either 1 or (both 2 and 3) are satisfied, then print yes
otherwise print no

This case gave me a huge amount of headache :

one snake is a line, and other one is a point, now if the point lies on the other snake , it satisfies both the conditions of being parallel to the other snake as well as being perpendicular to the other snake, and the answer it should give is yes, but if we check in case of perpendicular snakes, my code was giving no because i was checking endpoints.
Then i separately handled this case.

Here’s my solution //i am a newbie so my code may look like that

https://www.codechef.com/viewsolution/13737636

@sap96, the points in the input are unsorted. x21 can be > x22.

I have tried it a lot, but still, could not find a test case where my code goes wrong (getting a WA). Can someone please help me with a test case. I have tried all the cases mentioned above. Thanks.
My solution
https://www.codechef.com/viewsolution/13740189

Even if they are not overlapping but just connected by their end points they make a connected component as said in the ques
consider the test case:
2 1 8 1
1 1 1 7
and
2 1 8 1
8 2 11 2
Please tell me where am i wrong.

where is the link?