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 | ecnerwala | 3648 |
2 | Benq | 3580 |
3 | orzdevinwang | 3570 |
4 | cnnfls_csy | 3569 |
5 | Geothermal | 3568 |
6 | tourist | 3565 |
7 | maroonrk | 3530 |
8 | Radewoosh | 3520 |
9 | Um_nik | 3481 |
10 | jiangly | 3467 |
# | User | Contrib. |
---|---|---|
1 | maomao90 | 174 |
2 | awoo | 164 |
2 | adamant | 164 |
4 | TheScrasse | 159 |
4 | nor | 159 |
6 | maroonrk | 156 |
7 | -is-this-fft- | 150 |
8 | SecondThread | 147 |
9 | orz | 146 |
10 | pajenegod | 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 ; ){ ... }