As mike told me to post this in a blog, I am posting.
I am confused about the compiler in CF. 8586981 submission get AC in GNU C++0x but same code gets WA 8586869 in GNU C++. Will you please enlighten me about this.
Thank you.
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 156 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
As mike told me to post this in a blog, I am posting.
I am confused about the compiler in CF. 8586981 submission get AC in GNU C++0x but same code gets WA 8586869 in GNU C++. Will you please enlighten me about this.
Thank you.
Название |
---|
I tested the program and get following results:
g++-4.8 -m64 test.cpp -O2
get right result.g++-4.8 -m32 test.cpp -O2
get wrong result.g++-4.8 -m32 test.cpp -O2 -std=c++11
get right result.It's not a bug. It's just because, the constructor of
bitset
is defined differently in typical C++ and C++11. Reference of constructor of bitset is here.In typical C++, it's definedUnfortunately,
long
is defined 32-bit on x86. So if you pass along long
to the constructor, it will be convert to 32-bit and all things will be wrong.In C++11, it's defined
So everything will be right!
I didn't know this until I tested your program. Fortunately I never use
bitset
or I should have got some Wrong Answer because of this too.Thanks for your good example which shows the difference between two standards to us.
Sorry for my bad English.
Thank you loujunjie for enlightening me. No your english is not that bad. ;)