Weird type of compilation error: "Internal compiler error" happened on Codeforces

Правка en1, от Prady, 2025-06-13 22:00:41

Hello sirs

Today I submitted a code on Codeforces on the problem 1715D - 2+ doors using the GNU G++17 compiler. Here is the submission link: 324289603.

However, it failed to compile and threw compilation error, the error message saying:

Compilation message

This is the first time anything like this has happened with me, and it fascinated me that such a simple code with no 'modern' features breaks the G++ compiler easily, so I'm sharing it will you all.

Do note that my code doesn't strictly follow the C++17 standard, as I'm declaring an array using a non-constexpr int variable, which is a compiler extension provided by the G++ compiler, not supported by the C++17 standard.

When I changed the code to follow the standard, by declaring a constant size array irrespective of the value of $$$n$$$, it compiles fine: 324293933.

(Also it gives TLE, idk why, since I think the complexity is $$$O(30*(n+q))$$$, so if anyone can help in that I would be eternally thankful to you.)

Теги compilers, compilation error, time limit exceeded, compiler bug

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский Prady 2025-06-13 22:00:41 1459 Initial revision (published)