Chef and An Ideal Problem Dec 2018 Editorial (Unofficial)



Monty Hall Problem suggests that when a person swaps the doors after knowing the location of goat in one of the two doors. The probability of getting a car in the swapped door is 66%, increased from the previous 33%.
So, we can randomly choose the initial door and accordingly swap the doors. It’s a very naive approach but works.
My solution


Your soln is wrong.
It has 50% probability of failing.
If x=1 and y=2 or x=2 and y=1 you will get WA.
If x=3 and y=2 you code will not print z.


I completely agree with your answer, but maybe test cases were too weak.