Unexpected Behaviour of set and unordered_set

Submitted the same code one with set and other with unordered_set. One got AC while the order got WA.
AC (set) : https://www.codechef.com/viewsolution/25937828
WA (unordered_set) : https://www.codechef.com/viewsolution/25938015
The question is from July Long Challenge (Parity Again).
PS: Ordering doesn’t matter for the question.
Please help.
@vijju123 @l_returns @anon55659401

You shouldn’t insert anything while iterating it. I think that’s the issue.
Won’t go in understanding your code in much details unless you think it’s not the issue.

3 Likes

Got it. Thanks for the help.

1 Like

I also had the same problem with some code using unordered map
in codechef compiler it was giving wrong answer but on other online compilers it was giving correct answer.
Don’t know why