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 | 4009 |
2 | jiangly | 3831 |
3 | Radewoosh | 3646 |
4 | jqdai0815 | 3620 |
4 | Benq | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | gamegame | 3386 |
10 | ksun48 | 3373 |
# | User | Contrib. |
---|---|---|
1 | cry | 164 |
1 | maomao90 | 164 |
3 | Um_nik | 163 |
4 | atcoder_official | 160 |
5 | -is-this-fft- | 158 |
6 | awoo | 157 |
7 | adamant | 156 |
8 | TheScrasse | 154 |
8 | nor | 154 |
10 | Dominater069 | 153 |
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 :)