Hi Guys, I am trying to figure out the reason for the ambiguous behaviour of unordered_map on the CF Judge
The Question I am referring to is this 1728C - Digital Logarithm
Here are my submissions:
Output where I am getting a wrong answer for Test Case 2, Subcase 1 (n=6) 171472454
Output where I have printed the pairs for both maps (ma,mb) for Test Case 2, Subcase 1 (n=6) 171469543
Submission which got accepted 171472328, using an ordered_map and no other changes
On my local machine (g++ (Ubuntu 11.2.0-19ubuntu1) 11.2.0) as well as OnlineGdb C++ 17 both of my submissions (1,2) print correct answers with their respective map values. =>Local Machine
But all the compilers on cf judge give out ambiguous answers for different cases under Test Set 2
GNU C++17 : 171472454 WA on Test Set 2 for n=6
GNU C++20 (64) : 171472566 WA on Test Set 2 for some other n whereas n=6 gives out the correct output
In the second part of the output we can see that only the first value is being updated in the map whereas the rest are just traversed even after being >=10 =>Cf Judge
Could anyone clarify the reasons for these anomalies:
Why is unordered_map behaving ambiguously over different compilers on the cf judge
Why does the unordered_map work on local and onlinegdb whereas not on cf judge even after keeping the compiler version same
How does ordered_map pass all test cases on cf judge, is unordered_map not able to perform dynamic updates while traversing
Thanks in advance!