SAMESNAK - Editorial

Can please anyone help me find the error in this solution CodeChef: Practical coding for everyone

can anyone please tell me where did i go wrong here is my solution to the problem … i’d be glad if anyone can help me to find my mistake

Can Somebody please help me with this?? CodeChef: Practical coding for everyone

This is my Logic:

  • If both snakes are horizontal (or vertical) , at least one of the ends of a snake
    must be between or on the ends of the other.

  • If snake 1 is horizontal and snake 2 is vertical, exactly
    one end point of the snakes must coincide.

Can anyone please provide a test case for this solution ? The solution seems straightforward and easy to understand:
https://www.codechef.com/viewplaintext/13734952

can someone tell me,whats wrong with my solution,or suggest a test case it fails for
https://www.codechef.com/viewsolution/13760654
thanks

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

This is my solution. I guess the cases most users must be missing is complete overlap of two snakes.
eg

0 2 0 8
0 3 0 5

Here the answer should be yes. My solution is pretty simple, as it takes all cases into consideration and uses if-else alone to print the answer.

Can you please provide the test case for which my code fails.Link to my code is-
https://www.codechef.com/viewsolution/13772896

@jayprakash_a
test case failing
-1 2 -4 2 -1 2 8 2
answer should be no

@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.

@the_king_i_am

yes it was actually typing mistake

the original test case is:
1 2 4 2 -1 2 -8 2

ans: no

hi,
could anyone please look at my code and tell me for which test case it fails, i am unable to find the failed test case.

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

This is my code, can some one point out the mistake please link- CodeChef: Practical coding for everyone

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

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

I can’t find anything wrong in it.

Plz help me find the bug. Appreciate it.

Thanks in advance.

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

Can someone, please tell me where did I go wrong? I am having really a bit of trouble with this simple code!
https://www.codechef.com/viewsolution/13740052
thanks in advance

@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 :slight_smile:

1 Like

My someone help me which test cases my code fails!! I almost checked every test cases!! 2017-05-27_1033

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