Pagini recente » Cod sursa (job #2807264) | Cod sursa (job #594456) | Cod sursa (job #899463) | Cod sursa (job #3276893) | Cod sursa (job #2038312)
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
const int M=666013;
vector <int> TA[M+5];
vector <int>::iterator it;
int h(int key)
{
return key%M;
}
int main()
{
freopen("hashuri.in", "r", stdin);
freopen("hashuri.out", "w", stdout);
int n, tip, x, i, a;
scanf("%d", &n);
for(i=1; i<=n; i++)
{
scanf("%d%d", &tip, &x);
a=h(x);
if (tip==1)
TA[a].push_back(x);
else
if (tip==2)
{
it=find(TA[a].begin(), TA[a].end(), x);
if (it!=TA[a].end())
TA[a].erase(it);
}
else
if (tip==3)
{
it=find(TA[a].begin(), TA[a].end(), x);
if (it!=TA[a].end())
printf("1\n");
else
printf("0\n");
}
}
return 0;
}