# | User | Rating |
---|---|---|
1 | tourist | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | awoo | 154 |
8 | Dominater069 | 154 |
10 | luogu_official | 150 |
Name |
---|
Auto comment: topic has been updated by Sujay_27 (previous revision, new revision, compare).
Sum can be 1e14 which would lead to overflow you can set a upperlimit of 1e9
The maximum value that a long long variable can have is $$$2^{63} - 1$$$. In your code
sum
can be equal to $$$2 \cdot 10^{14}$$$ in some test cases and thusmid * mid
may get bigger than the long long limit.In worst case, the sum can be 2*10^14 then the mid will be 10^14. mid * mid will be 10^28. long long can hold at most 10^18.
Yeah got it! Thanks mate.
instead of binary search,why arent you using sqrt its much simpler code
yea I figured that, but wanted to try with binary search
it works if you use unsigned long long instead of signed long long (long long)
Oh ok
nah mate, unsigned long long only goes up to about 1.84*10^19, which is still nowhere near 10^28.