Byte-Ghifo's blog

By Byte-Ghifo, history, 14 months ago, In English

I got runtime error when using this custom compare function:

bool cmp(char& a, char& b){
	return id[a - 'a' + 1] >= id[b - 'a' + 1];
}

when I changed it to:

bool cmp(char& a, char& b){
	return id[a - 'a' + 1] > id[b - 'a' + 1];
}

I got AC.

does anyone know why did that happen?

lucky for me this didn't happen in a contest.

  • Vote: I like it
  • +3
  • Vote: I do not like it

»
14 months ago, # |
  Vote: I like it +22 Vote: I do not like it

This blog should be helpful.