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.
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 | jiangly | 3810 |
| 2 | Benq | 3676 |
| 3 | Kevin114514 | 3655 |
| 4 | maroonrk | 3463 |
| 5 | strapple | 3447 |
| 6 | Um_nik | 3387 |
| 7 | heuristica | 3322 |
| 8 | turmax | 3317 |
| 9 | tourist | 3307 |
| 10 | jiangbowen | 3291 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 156 |
| 2 | nik_exists | 150 |
| 2 | maspy | 150 |
| 4 | Um_nik | 141 |
| 5 | Errichto | 139 |
| 6 | adamant | 137 |
| 7 | AmShZ | 135 |
| 8 | BledDest | 132 |
| 9 | maroonrk | 131 |
| 10 | qwexd | 129 |
| Name |
|---|



I tested the program and get following results:
g++-4.8 -m64 test.cpp -O2get right result.g++-4.8 -m32 test.cpp -O2get wrong result.g++-4.8 -m32 test.cpp -O2 -std=c++11get right result.It's not a bug. It's just because, the constructor of
bitsetis defined differently in typical C++ and C++11. Reference of constructor of bitset is here.In typical C++, it's definedUnfortunately,
longis defined 32-bit on x86. So if you pass along longto 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
bitsetor 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. ;)