I'm so mad that C is wrong because I got the wrong data type!
# | User | Rating |
---|---|---|
1 | jiangly | 4039 |
2 | tourist | 3841 |
3 | jqdai0815 | 3682 |
4 | ksun48 | 3590 |
5 | ecnerwala | 3542 |
6 | Benq | 3535 |
7 | orzdevinwang | 3526 |
8 | gamegame | 3477 |
9 | heuristica | 3357 |
10 | Radewoosh | 3355 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | -is-this-fft- | 165 |
3 | atcoder_official | 160 |
3 | Um_nik | 160 |
5 | djm03178 | 158 |
6 | Dominater069 | 156 |
7 | adamant | 153 |
8 | luogu_official | 151 |
8 | awoo | 151 |
10 | TheScrasse | 147 |
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!