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?
Auto comment: topic has been updated by tatianyi (previous revision, new revision, compare).
https://mirror.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.
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.