To seem more cultured, Max has undertaken consuming all the best media generated ever!
Currently, he has different lists of media that he needs to fill up, but he cannot remember if he already added some media, so he will ask you
queries of
types:
1 i name
: Output if the
media list already has
in it and
otherwise.
2 i name
: Insert into the
media list.
Can you help maintain Max's media list?
Constraints
Each will be at most
lowercase letters.
Subtask 1 [40%]
Subtask 2 [60%]
No additional constraints.
Note: Fast I/O might be required to fully solve this problem (e.g., BufferedReader for Java).
Input Specification
The first line will contain two integers, and
, the number of media lists and queries, respectively.
The next lines will contain one of the
types of queries listed above.
Output Specification
For each type query, output
if that media list has
in it and
otherwise.
Sample Input 1
1 6
1 1 test
2 1 test
2 1 test
1 1 test
2 1 blah
1 1 pf
Sample Output 1
0
1
0
Sample Input 2
2 6
1 1 test
2 1 test
2 1 test
1 2 test
2 2 blah
1 2 blah
Sample Output 2
0
0
1
Comments