MAXAND18 wrong answer

https://www.codechef.com/viewsolution/35145244

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.

2 Likes

Doing that still gives a partial.
https://www.codechef.com/viewsolution/35157112

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.
https://www.codechef.com/viewsolution/35157678

Probably line 22

1 Like

Yup that was it. Thanks.