Pagini recente » Cod sursa (job #640072) | Cod sursa (job #2672375) | Cod sursa (job #518027) | Cod sursa (job #495795) | Cod sursa (job #3230305)
#include <bits/stdc++.h>
using namespace std;
ifstream fin ("hashuri.in");
ofstream fout ("hashuri.out");
const int MOD=666013;
vector <int> :: iterator it;
vector <int> h[MOD];
int ind;
vector <int> :: iterator find (int n)
{
for (it=h[ind].begin(); it!=h[ind].end(); it++)
{
if (*it==n)
return it;
}
return it;
}
void task1 (int n)
{
if (it==h[ind].end())
h[ind].push_back(n);
}
void task2 (int n)
{
if (it!=h[ind].end())
h[ind].erase(it);
}
bool task3 (int n)
{
if (it!=h[ind].end())
return 1;
return 0;
}
int main()
{
int n;
fin >> n;
for (int i=1; i<=n; i++)
{
int a,b;
fin >> a >> b;
ind=b%MOD;
it=find(b);
if (a==1)
task1(b);
else if (a==2)
task2(b);
else
fout << task3(b) << '\n';
}
return 0;
}