Pagini recente » Cod sursa (job #787462) | Cod sursa (job #2494813) | Cod sursa (job #2192475) | Cod sursa (job #2089745) | Cod sursa (job #3291573)
#include <bits/stdc++.h>
using namespace std;
ifstream fin ("hashuri.in");
ofstream fout ("hashuri.out");
const int mod=666013;
vector <int> h[mod];
int n, ind;
vector<int>::iterator it;
vector<int>::iterator find (int x)
{
for (it=h[ind].begin(); it!=h[ind].end(); it++)
{
if (*it==x)
return it;
}
return h[ind].end();
}
void add (int x)
{
if (it==h[ind].end())
h[ind].push_back(x);
}
void del (int x)
{
if (it!=h[ind].end())
h[ind].erase(it);
}
void afis (int x)
{
fout << (it!=h[ind].end()) << '\n';
}
int main()
{
fin >> n;
for (int i=1; i<=n; i++)
{
int cer, x;
fin >> cer >> x;
ind=x%mod;
it=find(x);
if (cer==1)
add(x);
if (cer==2)
del(x);
if (cer==3)
afis(x);
}
return 0