I'm so mad that C is wrong because I got the wrong data type!
# | User | Rating |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
# | User | Contrib. |
---|---|---|
1 | cry | 166 |
2 | maomao90 | 163 |
2 | Um_nik | 163 |
4 | atcoder_official | 161 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | nor | 153 |
9 | Dominater069 | 153 |
I'm so mad that C is wrong because I got the wrong data type!
Name |
---|
Don't be mad, take it as experience for later contests.
(Yesterday I used the wrong datatype for problem B, submitted and locked the problem immediately without optimizing the code. I was so careless and got TLE on test 9. After finished the contest, I just changed a few lines of code and it was Accepted. What a pity!)
Join the #define int long long cult! Everyone hates us, and they got a point, but this kind of mistake won't ever happen to you again
I think that #define long long long cult is better.
A good way to avoid these mistakes is to do a mental estimation of the upper bound of the absolute value before assigning datatypes. For example, if there's an array with $$$\le 2 \cdot 10^5$$$ elements between $$$-10^9$$$ and $$$10^9$$$, any subset sum of this array will be between $$$\pm 2 \cdot 10^{14}$$$, which clearly needs a 64-bit integer type. I try to be as specific about the bounds as possible, and it helps me verify my implementation as well, so I'd recommend others to do this too.
Me too!