dashrath1526's blog

By dashrath1526, history, 17 months ago, In English

Problem link

n = int(input())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
xy = set(x)
xy.update(y)

flag = False
while n > 0:
    if n in xy:
        n -= 1
        continue
    else:
        flag = True
        break

if flag:
    print('Oh, my keyboard!')
else:
    print('I become the guy.')

As per my understanding of the problem desc, I am not missing anything here. I am new here so correct me if I am wrong.

Test case description. Input 3

1 2

2 2 3

Participant's output I become the guy.

Jury's answer Oh, my keyboard!

Checker comment wrong answer 1st lines differ — expected: 'Oh, my keyboard!', found: 'I become the guy.'

 
 
 
 
  • Vote: I like it
  • -3
  • Vote: I do not like it

»
17 months ago, # |
Rev. 2   Vote: I like it +1 Vote: I do not like it

I think your mistake is that you are considering the number of indices that each player can pass as an index.

»
17 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

In the test case you are failing there are 3 levels that need to be passed (1,2,3) and the levels that can be passed are only 2 and 3 therefore the output should be "Oh, my keyboard!". I would suggest building an array from 1 to n (for 1 indexing) which would have only ones in it. And for every number you scan set the element with that index to 0.Also, looking at your solution I can see that you also take the first number in consideration, but you shouldn’t because it is the number of levels the player can pass but not a level the player can pass itself . Then make a linear scan and check if there is any number equal to one in the array. If there is at least one one then the answer is "Oh, my keyboard!", otherwise it's "I become the guy.".

Here's my implimentation in cpp:

And Here's my implimentation in Python

  • »
    »
    17 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Your solution is correct, but reasoning on below condition. This is what mentioned in problem explanation.

    levels need to be passed: 1 2 3 x can pass: 1 2 y can pass: 2 2 3 x and y together can pass : 1 2 3

    isn't it right?

    • »
      »
      »
      17 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      X and Y can pass together only 2 and 3. If you read the input details firstly you scan the number of levels x can pass and then the levels x can pass and the same goes for y

      • »
        »
        »
        »
        17 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Ohhhh, I misunderstood the input explanation, makes sense now. Thanks for helping.

»
2 months ago, # |
  Vote: I like it -8 Vote: I do not like it

you have to remove first element from both list x and y using pop like. n = int(input()) x = list(map(int,input().split())) y = list(map(int,input().split())) x.pop(0) y.pop(0) xy = set(x) xy.update(y)

flag = False while n > 0: if n in xy: n -= 1 continue else: flag = True break

if flag: print('Oh, my keyboard!') else: print('I become the guy.')

because the first no is no of levels that Participant'sis passing in case 27 x Participant passing only 1 level that is level 2 but with you appending the set with the no of levels also x is passing only 1 level so u r set contains 1 also but none of the participant passing level 1 thats why u getting error above code will solve this