Help with codeforces question

My code when k=421654016 ran into RE plz help why it is showing so…,

problem link: https://codeforces.com/problemset/problem/1368/B

my solution link: https://codeforces.com/contest/1368/submission/84649083

Thanks

int A[10];
x=ceil(log2(k));
for(i=0;i<x;i++) {
    A[i]++;
}

x comes to be 28. Array is of 10 elements.
You can’t access A[i] when i is greater than 9.

For the given k, your x reaches 28 while the array initialized by you has only memory for 10 integers. Hence, the RE.

Thanks got it

1 Like