WA in SAMESNAK

Can anyone point out why I got WA for this solution of SAMESNAK? I am just not able to figure out where I went wrong in this: CodeChef: Practical coding for everyone

Some details of the solution:

swapper() ensures that a1 and b1 coordinates occur before a2 and b2 respectively.

in_range() checks whether the given value lies between 2 values (used for the case where they both belonged to a single row or column).

linear_checker() checks for the case when both of them lie in a single row or column(uses in_range).

row_column() checks for the case when one lies in a row and another in a column. Just checked the end points of the snakes here.

I think problem I found the problem

Input
1
0 0 0 1
0 -10 0 50
Output
yes

This is correct. But what if i tweak it to-

Input
1
0 0 0 0
0 -10 0 50
Output
no
Expected Output
yes

I tested this case for one of the correct solutions, and it returned “yes” for it. So i think the error lies here. Hope this helps :slight_smile:

Can anyone point out where did i go wrong in this solution of SAMESNAK? I am just not able to figure out which test case its not satisfying :

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

ThankYou

Can anyone point out why I got WA for this solution of SAMESNAK? I am just not able to figure out where I went wrong in this: CodeChef: Practical coding for everyone
Some details of this solution:
hoanvi(int a, int b): swap a and b;
giaonhau(int a, int b, int c, int d): if [a,b] and [c,d] overlap, return 1 else return 0

Can someone figure out the error here:
https://www.codechef.com/viewsolution/13784859

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.

Thanks @vijju123. This question had been haunting me for 3 days now. Thanks a lot.

Hope you get AC soon. Comment in case you need additional help :slight_smile:

Your code fails here dear-

Input
1
0 0 0 100
5 50 0 50
Output
yes
Expected Output
no

Here, it is intersecting in ‘T’ shape, and problem statement clearly mentioned that a ‘no’ has to be printed for this case.

@vijju123 Can you figure out the test case im missing .Im getting correct output for the above test case you mentioned
Thanks :slight_smile:

Wait, what do you mean by “correct output”? If i am not wrong, the snakes here intersect as “|-” (T rotated by 90 degree anticlockwise). Here the vertex (0,50) is of degree 3 and hence a no has to be printed. Can you please show me your perspective/PoV so we can clarify it further? :slight_smile:

Thanks a lot @vijju123 . It was a connection issue due to which the comment got posted later .I was talking of the case which you pointed out for another user .

Two things-

Please get rid of those excess whitespaces. It becomes a headache for the person trying to fix/debug your code. Nobody would want to help if its inconvenient.

Secondly, the failing test case is this-

Input
1
1 2 2 2
5 2 -1 2

Output
no

Expected Output 
yes

Your code prints correctly for if i change “5 2 -1 2” to “5 2 1 2”, but prints wrong answer other than that (if that value is <1, eg- 0,-1 etc.). I believe its a case of complete overlapp of snakes. Look into it. :slight_smile:

Thanks for the help…

Surely I’ll do away with whitespaces