Pagini recente » Cod sursa (job #3121872) | Cod sursa (job #2661105) | Cod sursa (job #336691) | Cod sursa (job #1529371) | Cod sursa (job #873016)
Cod sursa(job #873016)
#include<fstream>
#include<vector>
using namespace std;
ifstream in("hashuri.in");
ofstream out("hashuri.out");
int n,i,x,y;
vector<int> a[100000];
vector<int>::iterator it;
int find(int x)
{
for (it=a[x%99999].begin();it!=a[x%99999].end();it++)
if (*it==x) return 1;
return 0;
}
void add(int x)
{
a[x%99999].push_back(x);
}
void remove(int x)
{
for (it=a[x%99999].begin();it!=a[x%99999].end();it++)
if (*it==x)
{
a[x%99999].erase(it);
return;
}
}
int main()
{
in>>n;
for (i=1;i<=n;i++)
{
in>>x>>y;
if (x==1) if (!find(y)) add(y);
if (x==2) if (find(y)) remove(y);
if (x==3) if (find(y)) out<<"1\n";
else out<<"0\n";
}
}