Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

codeforces A – I Wanna Be the Guy wrong answer in testcase 27

I am practicing problem solving by solving on Codeforces, but in problem "A-I Wanna Be the Guy". Here is the link for the problem.

My code gets rejected at testcase 27 which has input:

3
1 2
2 2 3

Here is my code:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, x; 
    cin >> n;
    set <int> s;
    while(cin >> x)
    {
        if(x != 0)
            s.insert(x);
        }
    if(s.size() == n)
        cout << "I become the guy." << endl;
    else
        cout << "Oh, my keyboard!" << endl;
    return 0;
}

My output is I become the guy., but the answer is Oh, my keyboard!.

To be honest, I am not sure why this testcase should give this output. If someone can take a look at the problem and help me, I would be grateful.

>Solution :

The first number in each of lines 2 and 3 is the count of following levels. It is not actually a level. So:

  • "1 2" means there is one level and that level is 2
  • "2 2 3" means there are two levels and those levels are 2 and 3

Consequently, no player passes level 1 and you should output "Oh, my keyboard!"

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading