Блог пользователя tatianyi

Автор tatianyi, история, 13 месяцев назад, По-английски

I'm solving this problem (2A). After some local tests, I submitted the code using the "MSC++ 2017" compiler(MSVC), as I initially wrote my code in Visual Studio 2022. However, although the "MSC++ 2022" compiler in VS successfully generated the correct answer for test case 1, my code got the wrong answer on test 1, with, even, an opposite output! Furthermore, when I switched to other compilers like "GNU G++ 20" or even "Clang++17 diagnostics", my code was accepted.

So, what happened exactly? Are there some hidden undefined behaviours in my code? Or is it have some bugs in this version of the MSVC compiler that CodeForces currently using?

  • Проголосовать: нравится
  • +6
  • Проголосовать: не нравится

»
13 месяцев назад, # |
  Проголосовать: нравится +11 Проголосовать: не нравится

Auto comment: topic has been updated by tatianyi (previous revision, new revision, compare).

»
13 месяцев назад, # |
Rev. 3   Проголосовать: нравится -58 Проголосовать: не нравится

https://codeforces.com/contest/2/submission/199352436

In MSVC, the &pair<int,int> syntax does not hold.

(you expect it to get "3,2", but it actually gives "1,2")

It's a slow language it doesn't even have bits/stdc++.h You should give up on it.

  • »
    »
    13 месяцев назад, # ^ |
      Проголосовать: нравится +21 Проголосовать: не нравится

    Oh, thank you! Your answer solved my confusion.

    I'm using this compiler after contests. Since MSVC seems to appear more often in projects, I expected to practice using this compiler as I may deal with it a lot in the future.