Pagini recente » Cod sursa (job #1945660) | Cod sursa (job #2436237) | Cod sursa (job #2607041) | Cod sursa (job #2726810) | Cod sursa (job #2617321)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
const int m=666013;
void op_1(int x);
void op_2(int x);
bool op_3(int x);
struct hsh
{
vector<int>h[m];
}H;
void op_1(int x)
{
if(op_3(x)==0)
{
int y=x%m;
H.h[y].push_back(x);
}
}
void op_2(int x)
{
int y=x%m;
int i=0;
for(auto&it:H.h[y])
{
if(it==x)
H.h[y].erase(H.h[y].begin()+i);
i++;
}
}
bool op_3(int x)
{
int y=x%m;
for(auto&it:H.h[y])
if(it==x)
return 1;
return 0;
}
int main()
{
int n;
fin>>n;
while(n--)
{
int op,x;
fin>>op>>x;
if(op==1)
op_1(x);
else if(op==2)
op_2(x);
else fout<<op_3(x)<<"\n";
}
return 0;
}