Pagini recente » Cod sursa (job #42535) | Cod sursa (job #385273) | Cod sursa (job #1912516) | Cod sursa (job #280714) | Cod sursa (job #2744986)
#include <bits/stdc++.h>
using namespace std;
ifstream in("hashuri.in");
ofstream out("hashuri.out");
const int prim = 666013;
int n, op, nr;
vector<int> v[prim];
void adauga(int x)
{
int val = x % prim;
v[val].push_back(x);
}
void sterge(int x)
{
int val = x%prim;
vector<int>::iterator i;
for(i=v[val].begin(); i!=v[val].end(); i++)
{
if(*i == x)
break;
}
if(i != v[val].end())
{
v[val].erase(i);
}
}
void op3(int x)
{
int val = x % prim;
vector<int>::iterator i;
for(i = v[val].begin(); i!=v[val].end(); i++)
if(*i == x)
break;
if(i != v[val].end())
out << 1<<'\n';
else out << 0 << '\n';
}
int main()
{
in>>n;
for(int i=0; i<n;i++)
{
in>>op>>nr;
switch(op)
{
case 1:
{
adauga(nr);
break;
}
case 2:
{
sterge(nr);
break;
}
case 3:
{
op3(nr);
break;
}
}
}
return 0;
}