Pagini recente » Cod sursa (job #2434134) | Cod sursa (job #3178187) | Cod sursa (job #1390465) | Cod sursa (job #2207114) | Cod sursa (job #2305875)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
const int MOD=100003;
vector <int> Hash[MOD];
bool Hash_check(int x)
{
int y=x%MOD;
for(int i=0;i<Hash[y].size();++i)
if(Hash[y][i]==x)
{
return 1;
}
return 0;
}
void Hash_add(int x)
{
if(!Hash_check(x))
{
Hash[x%MOD].push_back(x);
}
}
void Hash_del(int x)
{
for(int i=0;i<Hash[x%MOD].size();++i)
if(Hash[x%MOD][i]==x)
Hash[x%MOD][i]=-1;
}
int main()
{
int i,n,op,x;
fin>>n;
for(i=1;i<=n;++i)
{
fin>>op>>x;
if(op==1) Hash_add(x);
if(op==2) Hash_del(x);
if(op==3)
if(Hash_check(x)==1)
fout<<1<<"\n";
else fout<<0<<"\n";
}
return 0;
}