2022 G.W. Coding Contest 1 S2: Imposter Friends:

You have many friends! Of course, you want to visit all your friends, but you have too many friends to keep track of them all. So, each of your \(N\) friends gives you a time in minutes, to get to their house from your house, forming a non-decreasing list of these times.

A while after you've formed your list, \(M\) other "friends" ask you to visit their house as well. Suspicious, you decide to write a program to determine if they are your friend or not.

Output "yes" if friend \(i\) is your friend, and "no" if he is not.


Input Specification:
  • The first line will be \(N\) and \(M\) seperated by a space
  • The next \(N\) lines will be the time to get to your friends’ houses
  • The last line will be the time to get to the other houses

  • TIME CONSTRAINT: 0.03s

    Sample Input:

    4 2
    2
    3
    4
    6
    7
    6

    Sample Output:

    no
    yes

    Submit Solution

    Problem author: Vincent