My code:

I have tried every single test case that come to my mind. But it still gives a WA.
I don’t know why.

Thanks for your help.

If you see the code, there is a line that says “if(total<0)total=0;” that is for the case when the number of buildings is equal to 1 or 2, because that case gave the wrong answer for the code that i wrote, but after that it gives a wrong answer.
Please help.

And is there any way by which I can see the test cases that codechef enters to my code and further how do I think a test case that might be violating my code for future reference. Thanks… :slight_smile:

declare array size more than given in the constraints :

i used “char a[1003]” in your code and it got an AC.

1 Like

Hii… I think the code that you saw was the edited code, as I had been running it in ideone only.
That code will get accepted for a[1001] as well. The error was in line 19, where i was comparing i
to a string, like this i==‘0’, which was the error. Thank you so much for looking into my code. :slight_smile:

1 Like