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.
This blog should be helpful.
THX