Compiler's bug or mine?

Revision en4, by AliHeidary1381, 2019-02-26 07:12:52

I was getting a strange bug in my code. The buggy part of my code is the following:

1st Code

It gives the following error:

cc1plus.exe: out of memory allocating 134221823 bytes

And of course, I have 128 MB of free memory (It's more than 4 GB free).

But I thought that the problem might be from std::array, and I was right. So when I modified my code as:

2nd Code

The code compiles without any error. I am using MinGW w64 7.3.0 from here (it's exactly the codeforces's compiler, so the code get's compilation error when submitting) but other compilers haven't this problem (like CLang LLVM). Where do you think the problem is and why? And how can I solve it?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en4 English AliHeidary1381 2019-02-26 07:12:52 4
en3 English AliHeidary1381 2019-02-26 07:12:12 82
en2 English AliHeidary1381 2019-02-26 07:09:33 102
en1 English AliHeidary1381 2019-02-26 07:06:56 969 Initial revision (published)