@jeetu86044 for input -1 2 -4 2 -1 2 8 2 answer should be “yes” I guess.How can it be “no” when they have one overlapping point i.e. -1 2. Correct me if I am wrong.
From past two-three days I am not been able to find out where I am getting wrong. Here is Link of my solution.
Can you help me out please. @shashank96@sumedhk@jeetu86044@the_king_i_am
Can anyone help me? I am unable whats wrong with my code:
My logic is:
if both are horizontal and y11==y21:
if (smaller x co_ordinate of each snake is smaller than larger x co-ordinate of other) :
print(yes)
else:
print(no)
My code is:
https://www.codechef.com/viewsolution/13766079
plz someone help me whats wrong with this smaller x co_ordinate of each snake is smaller than larger x co-ordinate of other BY THIS I MEAN IS :
if x11<x12 and x21<x22 then in order to overlap we must have: x11<x22 and x21<x12
@free_bird Your code is failing on test case 0 0 0 0 , 0 1 0 -1 as your answer is no @kunwarpreet281 You are getting an error because you are printing extra new line before the answer @amartya_bhatt You are failing test case 0 0 0 0,1 0 -1 0 .Correct answer should be yes but your are getting no @babloo_1997 You failing both the test cases mentioned for free_bird and amartya_bhatt
@swamicoder You are failing the test case 0 0 0 -10,0 -5 10 -5.Remember not to use multiple relational operators in single statement as you have done in your code. For eg. for statement (i==j==k==l) ,when parsed your code will look like (((i==j)==k)==l) and now you can see very well why your code is failing. Happy coding
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
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