In the following two submissions 224059045 and 224058953 the only difference is one line where I replaced
memset(dc, n+5, sizeof(dc));
with
for(int i=1;i<=n;i++) dc[i] = n+5;
and it WA on the first but AC with the latter. I'm not sure why this is happening. Any ideas?