Pagini recente » Istoria paginii utilizator/daniel1999 | Cod sursa (job #764722)
Cod sursa(job #764722)
#include<iostream>
#include<fstream>
#include<set>
#define DIM 16900
using namespace std;
set<int> t[DIM+10];
int n;
int main()
{
ifstream fin ("hashuri.in");
ofstream fout ("hashuri.out");
fin>>n;
int op,x;
set<int>::iterator it;
for(int i=1;i<=n;i++)
{
fin>>op>>x;
int indx=x%DIM;
if(op==1)
t[indx].insert(x);
if(op==3)
{
it=t[indx].lower_bound(x);
if(*it==x)
fout<<"1"<<"\n";
else
fout<<"0"<<"\n";
}
if(op==2)
t[indx].erase(x);
}
return 0;
}