Why does this get an arithmetic error?
Разница между en1 и en2, 0 символ(ов) изменены
I'm back with a strange error... I came back on codeforces recently to see that my solution for [problem E] (https://codeforces.com/contest/1902/problem/E) in the most recent educational codeforces round had failed the system tests.↵

I had the correct algorithm, and I was stuck debugging my code for ages until I submitted a new piece of code which was almost exactly the same and it got accepted. [This](https://codeforces.com/contest/1902/submission/236217048) gets WA, and [this](https://codeforces.com/contest/1902/submission/236217083) gets AC. The only difference in the codes, is that in the second program, I casted a `size_t` to a `long long` before multiplying it to `n`.↵

Original: ```ans += (long long) s[i].size() * n;```↵

Modified: ```ans += s[i].size() * n;```↵

I wouldn't think it would be an overflow error since `size_t` is the same as `unsigned long long` (unless it isn't? — but it is on my machine). This doesn't get marked as an overflow error by the codeforces diagnostics either. What is happening here?

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский myst-6 2023-12-07 22:04:47 24
en2 Английский myst-6 2023-12-07 17:54:58 0 (published)
en1 Английский myst-6 2023-12-07 17:53:47 1080 Initial revision (saved to drafts)