Leonardo_Paes's blog

By Leonardo_Paes, history, 11 months ago, In English

In last educational problem C, I submitted what I thought was a wrong code (I even resubmmited shortly after). I didn't declare my answer variable as a long long, even though the worst case is 5000^3 which exceeds 10^10. Here is my code https://codeforces.me/contest/2182/submission/355744056

I suspect something weird is happening in the last cout, where the compiler is treating it as a long long, even though there is an int and an unsigned int being multiplied.

Any help is appreciated!

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

»
11 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Just guessing but prolly kras.size() is unsigned something and that does the trick.

»
11 months ago, hide # |
 
Vote: I like it +7 Vote: I do not like it

The .size() function returns a size_t type, which can be considered an unsigned long long when the testing machine is 64-bit.