CNPIIM says wrong answer, but I checked it!

Usually when it says “wrong answer,” I double check everything because I know something is wrong. But in this case, on my last submission I had, what I believe, to be perfect answers.

I went through the difficulty of checking test cases 4-10, by hand, which was quite boring. And yes, they were all correct.

Not only that, but I used a much slower algorithm (which I am extremely confident of), which was also consistent, for much higher test cases.

The only possible explanation is, maybe, I’m missing something about the problem.

1 Like

Welcome on CodeChef!

We would like to help you, but not in ongoing contest, because this is against the rules.

Please read more in guidelines.

4 Likes

Try understanding the constraints correctly. It may help you in finding the solution for your problem.
Strategies of on-going contest can’t be discussed during the period of contest.

3 Likes

@carljalal Please see the output of your code at 2400 and 2500.

It gives negative values for these test cases.

2 Likes

The answer for 2400 of my code is 32380837031
The answer for 2500 of my code is 36812076035
So they are positive…
I’ve checked it by hand, and… since the contest is over (sorry for asking the question before it was over), I’m still looking at the other players’ solutions. Thanks guys for responding, and … hopefully I’ll figure this out =) I’m sure there’s something wrong with my code…

And btw, (really, no offense to any people who designed the solutions viewer), but why does the solutions viewer… well, not view things in a very good font? Somethings are in a nice coding font, but some are in non-code font (I use Google Chrome), and… the indentation isn’t the best… I usually copy everything into my IDE just to see things properly. It would be a bonus if viewing submitted code on CodeChef website was more beautiful. =]

@formatting: viewer is not formatting it, just highlighting for example keywords. If not intended properly, that’s because contestant uploaded it so. We see that often in forum also :frowning:

1 Like

I checked your last submission (http://www.codechef.com/viewplaintext/3751619 ), and answer for 2400 is negative as @ronakymca wrote, see here - http://ideone.com/vyln1H

Thanks betlista. I changed my variable to unsigned long. So they are all positive now here http://ideone.com/5LaJXS

but now it gives me a value of 2452337667 on Ideaone

I’m so confused why my code isn’t the same as on Xcode… (I copy and pasted the same code from Ideaone)

On Xcode, I get this:

1 2500
36812076035
Program ended with exit code: 0

that’s because “unsigned long” is overflowing as the answer is of 11 digits
change it to “long long”

1 Like

Thanks, Yashv. It works now!