Pagini recente » Cod sursa (job #291728) | Cod sursa (job #1496066) | Cod sursa (job #2029558) | Cod sursa (job #2230757) | Cod sursa (job #2214831)
#include <bits/stdc++.h>
using namespace std;
#define modulo 999983
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
set<int>h[1000000];
int n;
void Add(int x)
{
int rest;
rest=x%modulo;
h[rest].insert(x);
}
void Erase(int x)
{
int rest;
rest=x%modulo;
h[rest].erase(x);
}
void Query(int x)
{
int rest;
rest=x%modulo;
set<int>::iterator it;
it=h[rest].lower_bound(x);
if(*it==x)
fout<<"1\n";
else fout<<"0\n";
}
int main()
{
int obt,x;
fin>>n;
for(int i=1;i<=n;i++)
{
fin>>obt>>x;
switch(obt)
{
case 1:
Add(x);
break;
case 2:
Erase(x);
break;
case 3:
Query(x);
break;
}
}
return 0;
}