Parvej's blog

By Parvej, history, 2 years ago, In English

I got a runtime error on the last Atcoder Regular Contest.

The problem is this .

My RE solution here .

Runtime Error Part
RE test case

I always wrote (char) ('a'+k)to get the kth letter from the alphabet and didn't get Runtime Error on any platform.

Why am I getting RE this time?

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
2 years ago, # |
  Vote: I like it +6 Vote: I do not like it

RTE here:

if (xx >= 0 && xx < n && yy >= 0 && yy < m) {
	int d = ch[xx][yy] - '0';
	f[d] = 1;
}

when ch[xx][yy] = '.', d = -2. On my machine it somehow modify the value of m and cause RTE:|

  • »
    »
    2 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Ah! Thank you very much.

    Didn't notice that.