Reminder: in case of any technical issues, you can use the lightweight website m1.codeforces.com, m2.codeforces.com, m3.codeforces.com. ×

### semiexp's blog

By semiexp, history, 3 years ago, ,

During our team training on Codeforces Gym, we noticed that a code which can easily be compiled in our computer gets CE (even the details for CE wasn't shown) on the Codeforces judge system.

After the training, I've investigated the cause of CE and finally I've found that the following code produces CE if compiled with GNU C++11:

#include <algorithm>
#include <cstdio>
using namespace std;
struct segtree
{
pair<int, int> data[1<<20];
};
segtree S;
int main()
{
return 0;
}


You may write codes like this when you implement Segment Trees or like.

This code can easily be compiled with GCC 4.8.4. However, if it is compiled with GCC 5.3.0, the compilation didn't finish at all. I suppose that compiling it takes much time with GCC 5.1.0 (which is used in Codeforces), too and very long compilation time caused CE without any detail.

Apparently, this problem is a bug of GCC; related problem is reported to GCC Bugzilla. The bug fix has already been released, so I expect that this problem will be fixed in GCC of later version. But currently we can't avoid this problem if we use GNU C++11.

My suggestions are: - Avoid using GNU C++11. The code above could be compiled with other compilers (such as GNU C++). - Avoid using array of std::pair in structs or classes, e.g. define a new struct instead of using std::pair for array members in structs. One of the cause of this problem is that std::pair has a constexpr default constructor.