# P2A - Editorial

Practice
Source

Author: SQU_Test

DIFFICULTY:
EASY

PREREQUISITES:
Basic programming, greedy.

PROBLEM:
There is a game called “I Wanna Be the Winner”, 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?

EXPLANATION:
The problem itself is easy. Just check if all the levels could be passed by Little X or Little Y.

TIME COMPLEXITY:
Time complexity of the solution is O(p + q) for inserting the passed levels on a set and O(1) to check if all levels are passed.

SOLUTIONS:

Setter’s Solution
``````    #include <iostream>
#include<set>

using namespace std;

int main()
{
int n,p,q;
cin>>n>>p;
set<int> level;
for(int i = 0; i < p; i++)
{
int f;
cin>>f;
level.insert(f);
}
cin>>q;
for(int i = 0; i < q; i++)
{
int f;
cin>>f;
level.insert(f);
}

cout<<((level.size() == n)? " I Wanna Be the Winner." : "Oh, my keyboard!")<<endl;

return 0;

}
``````