I have two solutions first, second for this problem You probably don't have to read all of this. The two solutions are identical except for the following:
I got wrong answer in one case: when I invoke function PLAY() and use cout like this
cout << "Impossible.\n";
but when I use cout but not call PLAY() or use printf(), answer is accepted.
void PLAY()
{
ios_base::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
}
Any explanations ?