Pagini recente » Cod sursa (job #2693440) | Cod sursa (job #1912427) | Cod sursa (job #207446) | Cod sursa (job #2004227) | Cod sursa (job #2373247)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
int n, x, y;
const int p=666013;
vector<int> h[p];
vector<int>::iterator find_value(int x)
{
vector<int>::iterator it;
for(it=h[x%p].begin(); it!=h[x%p].end(); it++)
if(*it==x)
return it;
return h[x%p].end();
}
void insert_value(int x)
{
if(find_value(x)==h[x%p].end())
h[x%p].push_back(x);
}
void erase_value(int x)
{
if(find_value(x)!=h[x%p].end())
h[x%p].erase(find_value(x));
}
int main()
{
fin >> n;
while(n--)
{
fin >> x >> y;
if(x==1)
insert_value(y);
if(x==2)
erase_value(y);
if(x==3)
fout << (find_value(y)!=h[y%p].end()) << "\n";
}
return 0;
}