Why I am getting different output? Someone please explain the reason behind the WA. Ideoned code: https://ideone.com/ZjNybK CF Submission: https://mirror.codeforces.com/contest/1114/submission/49755099
# | 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 | 160 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | Dominater069 | 154 |
9 | awoo | 153 |
10 | luogu_official | 150 |
Why I am getting different output? Someone please explain the reason behind the WA. Ideoned code: https://ideone.com/ZjNybK CF Submission: https://mirror.codeforces.com/contest/1114/submission/49755099
Name |
---|
LONG_MAX is basically 2147483647. So, the answer can be greater than 2147483647. That's it is giving Wrong Answer. Use LLONG_MAX instead.
Thanks but still WA :|
Overflow.
Brother, my soln too got a wa https://mirror.codeforces.com/contest/1114/submission/49716174 Can anyone explain why?
https://ideone.com/jfyHLZ This is Your AC solution. The problem was due to over flow when you multiply e = e * x.f Instead if u check if e <= n / x.f it will work finely. I was also unable to find this during the contest.
Yeah it got too late to realise that. Thanks by the way!
Overflow in this line " for(long long i=mp;n/i>=1;i = i*mp) "
For example: i = mp = 100000015333 and n = 1e12, n still larger than i but i * i will be overflowed
Where will I set the condition? I am confused :|
Accepted, thanks, btw :)