Help with codeforces question

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

problem link:

my solution link:


int A[10];
for(i=0;i<x;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