WHY THIS CODE DIDN'T ACCEPTED DURING COOK-A-CODE

Do you by any chance mean just because he put the bracket around n, a wrong answer came?

No; this bit in his code:

 if(n<=k)
        {
           cout<<"A\n";            
        }

would make the answer come out as A for N=0, whereas yours would be B. @sunil5798’s hypothesis is that the constraints are wrong, and that one of the testcases has N=0. I also think this is the most plausible scenario.

5 Likes

i dont like when such thing happens… author should carefully make test cases… i am depressed that my team wasn’t able to solve this problem due to this issue…:cry::cry::cry:

Yup, but according to the problem it should be A only(I guess, because he starts with 0). But yes, you have given me a possibility of why his answer can be wrong. Even though I didn’t understand how :thinking:

Well, we might be wrong and the testcases might be fine, but this is the only thing I can think of that would cause the OP’s code to give the wrong answer.

6 Likes

@ssjgz thanks for your time…but only one question remains in my mind… how to deal with such problems when my code is correct but still WA appears… how to tackle… take this problem as example…

This seems like the most plausible scenario. If you have a look at this code
https://www.codechef.com/viewsolution/30001819
You can see that it is the exact same solution, the only difference is that here there is an extra condition in the beginning
if(n==0) cout<<"B\n";
And this yields an AC.

5 Likes

wow, you checked all the codes?

2 Likes

Same problem with my code.
As this is constraints issue, Will @admin reconsider the submissions?

for _ in range(int(input())):
    n,m=map(int,input().split())
    if n<=m:
        print("A")
    elif n%(m+1)==0:
        print("B")
    else:
        print("A")

1 Like

@mittal_sahab please reconsider this if possible

@anon44231457 @sunil5798 @hblord787 , @ssjgz is right. Actually one of our test case file contains n=0, which is producing contradicting answers. We forgot to take this scenario into account while generating our test case file. We are really sorry for this blunder and inconvenience caused by it , hope you understand.

3 Likes

Hats off to @sunil5798 for correctly diagnosing it before everyone else :slight_smile:

1 Like

So the fault was in test case!

@anon44231457 , @hblord787, @rohit_iiitl : we wasted 3 hours on this wow… :rofl::rofl::rofl::rofl: that was a nice blunder. special thanks to @mittal_sahab

Yes and we are really sorry for that.

3 Likes

so do we get points ??

At least you can rejudge the submissions with correct test cases?

1 Like

I think it will be great mess if they want to give point to all who did like this.

A big Thanks For your SORRY … our team wasted 3 hours for this silly mistake!

Please rejudge all submissions with correct test cases, Ranklist should be updated accordingly.

@admin
@mittal_sahab
Who is responsible for wrong input files in questions (beyond constraints).
I don’t expect this from codechef problems , especially during contests!