Pagini recente » Cod sursa (job #2929558) | Cod sursa (job #1010521) | Cod sursa (job #1022349) | Cod sursa (job #104193) | Cod sursa (job #2624911)
#include <bits/stdc++.h>
#define mod 100003
using namespace std;
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
vector <pair<int,int> >v[100010];
void AddHash(int x)
{
int rest=x%mod;
for(int i=0;i<v[rest].size();i++)
{
if(v[rest][i].first=x)
{
v[rest][i].second=1;
return;
}
}
v[rest].push_back({x,1});
}
void DeleteHash(int x)
{
int rest=x%mod;
for(int i=0;i<v[rest].size();i++)
if(v[rest][i].first==x)
{
v[rest][i].second=0;
return;
}
}
int VerifHash(int x)
{
int rest=x%mod;
for(int i=0;i<v[rest].size();i++)
if(v[rest][i].first==x)
return (v[rest][i].second);
return 0;
}
int n,op,x,i;
int main()
{
fin>>n;
for(i=1;i<=n;i++)
{
fin>>op>>x;
if(op==1)AddHash(x);
else if(op==2)DeleteHash(x);
else fout<<VerifHash(x)<<"\n";
}
return 0;
}