Codeforces 469A I Wanna Be the Guy Solution & Explanation

Difficulty : 800

Problem Description

There is a game called “I Wanna Be the Guy”, consisting of n levels. Little X and his friend Little Y are addicted to the game. Each of them wants to pass the whole game.

Little X can pass only p levels of the game. And Little Y can pass only q levels of the game. You are given the indices of levels Little X can pass and the indices of levels Little Y can pass. Will Little X and Little Y pass the whole game, if they cooperate each other?

Input

The first line contains a single integer n (1 ≤  n ≤ 100).

The next line contains an integer p (0 ≤ p ≤ n) at first, then follows p distinct integers a1, a2, …, ap (1 ≤ ai ≤ n). These integers denote the indices of levels Little X can pass. The next line contains the levels Little Y can pass in the same format. It’s assumed that levels are numbered from 1 to n.

Output

If they can pass all the levels, print “I become the guy.”. If it’s impossible, print “Oh, my keyboard!” (without the quotes).

Examples

Input4
3 1 2 3
2 2 4
OutputI become the guy.
Input4
3 1 2 3
2 2 3
OutputOh, my keyboard!

Note

In the first sample, Little X can pass levels [1 2 3], and Little Y can pass level [2 4], so they can pass all the levels both.

In the second sample, no one can pass level 4.


Solution

We can use a HashSet to store the levels that Little X and Little Y can pass. Then, we can check if they can complete the entire game.

C# Solution

Solution1 – HashSet

int n = int.Parse(Console.ReadLine());

HashSet<string> hSet = new HashSet<string>();
for (int k = 0; k < 2; k++)
{
    string[] arr = Console.ReadLine().Split(' ').ToArray();
    
    for (int i = 1; i < arr.Length; i++)
    {
        hSet.Add(arr[i]);
    }
}


Console.WriteLine(hSet.Count == n ? "I become the guy." : "Oh, my keyboard!");


Conclusion

🧡If my solution helps, that is my honor!

🧡You can support me by sharing my posts, thanks you~~

✅If you got any problem about the explanation or you need other programming language solution, please feel free to let me know !!

The problem link : Problem – 469A – Codeforces

Random Codeforces Posts

Leave a Reply

Your email address will not be published. Required fields are marked *