[Solution] Three Doors Codeforces Solution 2022
There are three doors in front of you, numbered from to from left to right. Each door has a lock on it, which can only be opened with a key with the same number on it as the number on the door.
There are three keys — one for each door. Two of them are hidden behind the doors, so that there is no more than one key behind each door. So two doors have one key behind them, one door doesn't have a key behind it. To obtain a key hidden behind a door, you should first unlock that door. The remaining key is in your hands.
Can you open all the doors?
The first line contains a single integer () — the number of test cases.
The first line of each test case contains a single integer () — the number on the key in your hands.
Three Doors Codeforces Solution 2022
Also Try Minecraft Codeforces Solution
Recover an RBS Codeforces Solution
Rorororobot Codeforces Solution
Multiset of Strings Codeforces Solution
The second line contains three integers and () — the number on the key behind each of the doors. If there is no key behind the door, the number is equal to .
Values and appear exactly once among and .
For each testcase, print "YES" if you can open all the doors. Otherwise, print "NO".
No comments:
Post a Comment