Pagini recente » Cod sursa (job #833623) | Cod sursa (job #1923175) | Cod sursa (job #2959208) | Cod sursa (job #2134055) | Cod sursa (job #2036815)
#include <cstdio>
#include <algorithm>
#include <vector>
const int MOD=666013;
using namespace std;
vector <int> T[MOD+5];
int h(int key)
{
return key%MOD;
}
int main()
{
freopen("hashuri.in", "r", stdin);
freopen("hashuri.out", "w", stdout);
int n;
scanf("%d", &n);
for(int i=1;i<=n;i++)
{
int q, x;
scanf("%d%d", &q, &x);
int r=h(x);
vector<int>::iterator it;
it=find(T[r].begin(), T[r].end(), x);
if(q==1)
{
if(it!=T[r].end())
continue;
else
T[r].push_back(x);
}
else if(q==2)
{
if(it!=T[r].end())
T[r].erase(it);
else
continue;
}
else
{
if(it!=T[r].end())
printf("1\n");
else
printf("0\n");
}
}
return 0;
}