Prady's blog

By Prady, history, 10 months ago, In English

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.)

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it