Hi codeforces community, I was solving 1820B - JoJo's Incredible Adventures and I got WA when I used s.length()*s.length(), but got AC when I used n*n (but n is the same as s.length()).
Is this supposed to happen?
299256114 is the AC code and 299255008 is the other one. Check the second "else if" statement at the end.
Auto comment: topic has been updated by Always_WA14 (previous revision, new revision, compare).
s.length() is a value of type size_t, which only stores from 0 up to 2^32, so it'll overflow if you try to multiply (since n^2 can be up to 1e10 or so)
okay yeah makes sense, thanks a lot!