Pagini recente » Cod sursa (job #1521923) | Cod sursa (job #392622) | Cod sursa (job #600619) | Cod sursa (job #3169952) | Cod sursa (job #1582459)
#include <cstdio>
#include <vector>
#define MOD 666013
using namespace std;
int N;
vector<int> G[MOD];
inline vector<int>::iterator find_value(int y)
{
int lst=y%MOD;
vector<int>::iterator it;
for(it=G[lst].begin();it!=G[lst].end();++it)
if(*it==y) return it;
return G[lst].end();
}
inline void insert_value(int y)
{
int lst=y%MOD;
if(find_value(y)==G[lst].end())
G[lst].push_back(y);
}
inline void erase_value(int y)
{
int lst=y%MOD;
vector<int>::iterator it=find_value(y);
if(it!=G[lst].end())
G[lst].erase(it);
}
void rezolva_problema()
{
int i, x, y;
scanf("%d", &N);
for(i=1;i<=N;++i)
{
scanf("%d%d", &x, &y);
if(x==1)
{
insert_value(y);
continue;
}
if(x==2)
{
erase_value(y);
continue;
}
printf("%d\n", find_value(y)!=G[y%MOD].end());
}
}
int main()
{
freopen("hashuri.in", "r", stdin);
freopen("hashuri.out", "w", stdout);
rezolva_problema();
return 0;
}