CtrlAlt's blog

By CtrlAlt, history, 5 months ago, In English

When I solve problems on Codeforces I use primarily Microsoft Visual C++ compiler, and its currently latest version available on the site is 2017.

Occasionally I noticed that some of my correct submissions got WA1, and I usually got AC by resubmitting the same code with G++ compiler chosen. So far, I have not had time to deal with this issue in more detail. But today this situation has happened again, so I decided to figure it out.

Apparently the problem is with reading the contents of pairs or structures in a vector via structured bindings. Few examples: 122689729 vs 122691303 and 122691453 vs 122691571

Curiously, printing similar values via structured bindings causes no problems.

According to this page, the structured bindings are supported in MSVC since version 2017 15.3. I've managed to find an environment with 2017 15.9.9 compiler version, and the abovementioned problems do not appear there.

Unfortunately, the specific version of MSVC compiler used on Codeforces was not explicitly stated. MikeMirzayanov, if you have time, could you please update the compiler if its minor version is too old. Also, it would be great to update the page with a list of actual compilers and their options. Thanks in advance!

Read more »

  • Vote: I like it
  • +19
  • Vote: I do not like it