VK Cup 2016 - Round 1
A
Bear and Displayed Friends
Codeforces
1200
原题
←B →
翻译中…

Limak is a little polar bear. He loves connecting with other bears via social networks. He has $*n*$ friends and his relation with the $*i*$-th of them is described by a unique integer $*t*_{*i*}$. The bigger this value is, the better the friendship is. No two friends have the same value $*t*_{*i*}$.

翻译中…

Spring is starting and the Winter sleep is over for bears. Limak has just woken up and logged in. All his friends still sleep and thus none of them is online. Some (maybe all) of them will appear online in the next hours, one at a time.

翻译中…

The system displays friends who are online. On the screen there is space to display at most $*k*$ friends. If there are more than $*k*$ friends online then the system displays only $*k*$ best of them — those with biggest $*t*_{*i*}$.

翻译中…

Your task is to handle queries of two types:

翻译中…
  • "1 id" — Friend $*id*$ becomes online. It's guaranteed that he wasn't online before.
  • "2 id" — Check whether friend $*id*$ is displayed by the system. Print "YES" or "NO" in a separate line.
翻译中…

Are you able to help Limak and answer all queries of the second type?

翻译中…

Input

翻译中…

The first line contains three integers $*n*$, $*k*$ and $*q*$ ($1 ≤ *n*, *q* ≤ 150 000, 1 ≤ *k* ≤ *min*(6, *n*)$) — the number of friends, the maximum number of displayed online friends and the number of queries, respectively.

翻译中…

The second line contains $*n*$ integers $*t*_{1}, *t*_{2}, ..., *t*_{*n*}$ ($1 ≤ *t*_{*i*} ≤ 10^{9}$) where $*t*_{*i*}$ describes how good is Limak's relation with the $*i*$-th friend.

翻译中…

The $*i*$-th of the following $*q*$ lines contains two integers $*type*_{*i*}$ and $*id*_{*i*}$ ($1 ≤ *type*_{*i*} ≤ 2, 1 ≤ *id*_{*i*} ≤ *n*$) — the $*i*$-th query. If $*type*_{*i*} = 1$ then a friend $*id*_{*i*}$ becomes online. If $*type*_{*i*} = 2$ then you should check whether a friend $*id*_{*i*}$ is displayed.

翻译中…

It's guaranteed that no two queries of the first type will have the same $*id*_{*i*}$ becuase one friend can't become online twice. Also, it's guaranteed that at least one query will be of the second type ($*type*_{*i*} = 2$) so the output won't be empty.

翻译中…

Output

翻译中…

For each query of the second type print one line with the answer — "YES" (without quotes) if the given friend is displayed and "NO" (without quotes) otherwise.

翻译中…

Note

翻译中…

In the first sample, Limak has $4$ friends who all sleep initially. At first, the system displays nobody because nobody is online. There are the following $8$ queries:

翻译中…
  1. "1 3" — Friend $3$ becomes online.
  2. "2 4" — We should check if friend $4$ is displayed. He isn't even online and thus we print "NO".
  3. "2 3" — We should check if friend $3$ is displayed. Right now he is the only friend online and the system displays him. We should print "YES".
  4. "1 1" — Friend $1$ becomes online. The system now displays both friend $1$ and friend $3$.
  5. "1 2" — Friend $2$ becomes online. There are $3$ friends online now but we were given $*k* = 2$ so only two friends can be displayed. Limak has worse relation with friend $1$ than with other two online friends ($*t*_{1} < *t*_{2}, *t*_{3}$) so friend $1$ won't be displayed
  6. "2 1" — Print "NO".
  7. "2 2" — Print "YES".
  8. "2 3" — Print "YES".
翻译中…

样例

Input #1
4 2 8
300 950 500 200
1 3
2 4
2 3
1 1
1 2
2 1
2 2
2 3
Output #1
NO
YES
NO
YES
YES
InputCopy OutputCopy
Input #2
6 3 9
50 20 51 17 99 24
1 3
1 4
1 5
1 2
2 4
2 2
1 1
2 4
2 3
Output #2
NO
YES
NO
YES
InputCopy OutputCopy
题目信息
题号
639A
时间限制
2 s
内存限制
256 MB
标签
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。