Pagini recente » Cod sursa (job #2540158) | Cod sursa (job #2160664) | Cod sursa (job #23335) | Cod sursa (job #379367) | Cod sursa (job #3243366)
#include <bits/stdc++.h>
#define MOD 666013
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
vector<int> h[MOD+10];
int ok, n,x, c, y;
int main()
{
fin>>n;
for(int i=1;i<=n;++i)
{
fin>>c>>x;
y=x%MOD;
if(c==1)
{
if(h[y].empty()==true)
h[y].push_back(x);
else{
ok=1;
for(auto j:h[y])
if(j==x)
ok=0;
if(ok==1)
h[y].push_back(x);
}
}
if(c==2)
{
vector<int>:: iterator j;
for(j=h[y].begin();j!=h[y].end();++j)
if(*j==x)
{
h[y].erase(j);
--j;
}
}
if(c==3)
{
ok=0;
for(auto j:h[y])
if(j==x)
ok=1;
fout<<ok<<'\n';
}
}
return 0;
}