Whats wrong in my first submission and whats right with the second one in EVENTUAL july cookoff 2020?

My first submission where i used xori ^= (int) s[i] resulted in WA
link → CodeChef: Practical coding for everyone

while when i used xori ^= (int) (s[i]-65) then it worked .
link → CodeChef: Practical coding for everyone

In my thought the first one should have worked just fine but it did’nt happen . Why ?

1 Like

Output for
1
6
fbedfc
should be NO, but first code is giving yes. I guess you should look at binaries from here on.

1 Like

Thanks for the test case. I found the fault. My solution was giving wrong answers for strings with cases like (1^2)^3 --> 3^3 --> 0

But I still am not able to find that if my first submission was wrong then the second one would have been wrong too because if --> (1^2)^3==0 then subtracting 65 would not do anything to it .

So i conclude that it was just my luck that the tc passed okay with my 2nd solution .

1 Like