Problem O
Guest List
Languages
en
is

A new hotel has implemented strict entry rules, allowing access only to those on a special guest list. Due to high demand and technical issues with maintaining the list on paper, a command-line program is needed to register, remove, and check names on the list.
Input
-
The first line contains the positive integer $N$, representing the number of commands that follow.
-
The next $N$ lines contain commands of the following types:
-
+ name – Adds a name to the guest list.
-
- name – Removes a name from the guest list.
-
? name – Checks whether a name is on the guest list.
-
Names only include the English lowercase letters a to z and names are at most $8$ characters in length. A name that’s already on the list will never be added again, and no name will be removed that’s not on the list.
Output
For each ? name command, the program should print Jebb if the name is on the list, otherwise Neibb.
Scoring
Group |
Score |
Constraints |
1 |
20 |
Only ? name commands and $N \leq 20$. |
2 |
50 |
$N \leq 1\, 000$. |
3 |
30 |
$N \leq 200\, 000$. |
Sample Input 1 | Sample Output 1 |
---|---|
5 + alex ? alex ? eva + eva ? eva |
Jebb Neibb Jebb |
Sample Input 2 | Sample Output 2 |
---|---|
8 + alex ? alex - alex ? alex + eva ? eva - eva ? eva |
Jebb Neibb Jebb Neibb |