MAXAND18 wrong answer

Can someone see where my code is wrong?

Read the problem statement again, word-for-word

1 Like

The biggest mistake is that you’re using pow().
Let’s say that you want to store 2^{30}. You would simply do pow(2, 30) right?
No. pow(2, 30) gives 1.07374e+09 instead of 1073741824.
Change the line to long long power = (1LL << i);. I’m not sure about your logic though. First fix this issue and try.


Doing that still gives a partial.

You’re still using pow

1 Like

Changing that still causes WA in Sub task 1. I don’t see how a smaller subtask is failing.

Probably line 22

1 Like

Yup that was it. Thanks.