GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Thursday 21 July 2022

[Solution] Three Doors Codeforces Solution 2022



A. Three Doors
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

There are three doors in front of you, numbered from 1 to 3 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.

Solution Click Below:-  👉CLICK HERE👈
👇👇👇👇👇

Can you open all the doors?

Input

The first line contains a single integer t (1t18) — the number of test cases.

The first line of each test case contains a single integer x (1x3) — 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 

XOR Tree Codeforces Solution

Multiset of Strings Codeforces Solution

The second line contains three integers a,b and c (0a,b,c3) — the number on the key behind each of the doors. If there is no key behind the door, the number is equal to 0.

Values 1,2 and 3 appear exactly once among x,a,b and c.

Output

For each testcase, print "YES" if you can open all the doors. Otherwise, print "NO".


No comments:

Post a Comment