Hi everyone :) i was submitting
Educational Codeforces Round 17 problem A but on test 9 it gives me the correct answer but CF judge says different !! what should i do ?24222811
thanks :) Good day :)
# | User | Rating |
---|---|---|
1 | tourist | 3880 |
2 | jiangly | 3669 |
3 | ecnerwala | 3654 |
4 | Benq | 3627 |
5 | orzdevinwang | 3612 |
6 | Geothermal | 3569 |
6 | cnnfls_csy | 3569 |
8 | jqdai0815 | 3532 |
9 | Radewoosh | 3522 |
10 | gyh20 | 3447 |
# | User | Contrib. |
---|---|---|
1 | awoo | 161 |
2 | maomao90 | 160 |
3 | adamant | 157 |
4 | maroonrk | 154 |
5 | -is-this-fft- | 148 |
5 | atcoder_official | 148 |
5 | SecondThread | 148 |
8 | Petr | 147 |
9 | TheScrasse | 145 |
9 | nor | 145 |
Name |
---|
v.size() is an unsigned integer, when it equals 0, v.size() — 1 will be a large integer. So accessing v[i] would be undefined behaviour.
AC code (changing v.size() to (int)v.size()):
http://codeforces.com/contest/762/submission/24223520
thanks alot :)
v.size() - 1
is unsigned, so whenv
is empty it becomes equal to 4,294,967,295. Use(int) v.size() - 1
to make it work.Also, you might want to enable compiler warnings locally, so that the compiler reminds you about similar issues in the future.
thanks a lot :)
good idea :)
Probably you're not using the same compiler as codeforces!
yes that seemed to be the problem thx :)
use -->0 operator
for(size_t i = v.size(); i -->0 ; ){ ... }