oh, I know the problem you talk about!
I just don't remember how I think at that moment.
But I think you are right, something wrong with the code there, and I don't know why I get AC with this problem.
Maybe this way of the negative overflow is more reasonable:
-(res*10 + X%10) < INT_MIN
and then INT_MIN+res*10+X%10 > 0
I will edit my code for the new way
Thanks for your suggestion!