Pagini recente » Cod sursa (job #1943068) | Cod sursa (job #1630795) | Cod sursa (job #766986) | Cod sursa (job #782248) | Cod sursa (job #3121240)
#include <bits/stdc++.h> //80p cu map - timp depasit
// set //arbore echilibrat binar O(log(n)) - operatiile
using namespace std;
int n,op,x,i,NR;
set <int> M;
int main()
{
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
fin>>n;
for (i = 1; i <= n; i++)
{
fin>>op>>x;
if (op == 1 && M.find(x)==M.end()) M.insert(x);
if (op == 2) M.erase(x);
if (op == 3) fout<<( M.find(x) != M.end())<<'\n';
}
fout.close();
return 0;
}
//var I
//#include <cstdio>//80p cu set - timp depasit
//#include <set>
//using namespace std;
//int n,op,x,i;
//set<int> A; //arbore echilibrat binar operatii O(log(n))-insert, erase,find
//
//int main()
//{
// freopen("hashuri.in", "r", stdin);
// freopen("hashuri.out", "w", stdout);
// scanf("%d", &n);
// for(i=1;i<=n;i++)
// {
// scanf("%d %d", &op, &x);
// if (op == 1)
// { A.insert(x); continue; }
// if (op == 2)
// { A.erase(x); continue; }
// printf("%d\n", A.find(x) != A.end());
// }
// return 0;
//}