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.
# | 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 | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | awoo | 154 |
8 | Dominater069 | 154 |
10 | luogu_official | 151 |
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.
Name |
---|
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. ;)