//拉链法hash
#include<cstring>
#include<iostream>
using namespace std;
const int N = 100005;
int h[N],e[N],ne[N],idx = 0;//h[N]是hash表,e[N]、ne[ne]、idx分别为链表值、下一个结点、当前结点
void insert(int x)
{
int k = (x % N + N) % N;//取模映射,+N是为了将负数变成正数
e[idx] = x;
ne[idx] = h[k];
h[k] = idx++;//在k位置插入当前数
}
bool find(int x)
{
int k = (x % N + N)%N;
for(int i = h[k];i != -1;i = ne[i])
{
if(e[i] == x)return true;//链表遍历,找到是否有x
}
return false;
}
int main()
{
int n;
cin>>n;
memset(h,-1,sizeof(h));//将h初始化为-1
while(n--)
{
char op;
int x;
cin>>op;
cin>>x;
if(op == '1')insert(x);
else
{
if(find(x))cout<<"yes"<<endl;
else cout<<"No"<<endl;
}
}
return 0;
}
//开放寻址法
#include<iostream>
using namespace std;
const int N = 200003,null = 0x3f3f3f3f;//null是10^9
int h[N];
int find(int x)
{
int k = (x % N + N)%N;//取模映射,+N是为了将负数变成正数
while(h[k] != null&&h[k] != x)
{
k++;
if(k == N)k = 0;
}//如果当前位置被占,找到下一个位置
return k;
}
int main()
{
int n;
cin>>n;
memset(h,0x3f,sizeof(h));
while(n--)
{
char op;
int x;
cin>>op>>x;
int k = find(x);
if(op == '1')h[k] = x;
else
{
if(h[k] != null)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}
}
return 0;
}