While solving theCodeforces Round #192 (Div. 2), problem: (A) Cakeminator, I noticed that the output differs whenever I use the gcc compiler as opposed to the microsoft one.
The solution was judged correct, but only when I used the microsoft c++ compiler.
Here are the links to the two solutions:
Can anyone point out what causes this weird behavior?








this " if(row[r — 1] != i) row[r++] = i; " and this "if(col[c — 1] != j) col[c++] = j;"
does not look good to me, both "r" and "c" variables are set to zero, and when those lines executed for the first time you will try to access row[-1] and col[-1], which is undefined behaviour