Pagini recente » Cod sursa (job #2312370) | Cod sursa (job #1624193) | Cod sursa (job #1623436) | Cod sursa (job #863212) | Cod sursa (job #3121241)
#include <bits/stdc++.h> // cu map
// map //arbore echilibrat binar O(log(n)) - operatiile
using namespace std;
int n,op,x,i,NR;
map <int, 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.insert(make_pair(x,1));
if (op == 2) M.erase(x);
if (op == 3) fout<<( M.find(x) != M.end())<<'\n';
}
fout.close();
return 0;
}
//#include <bits/stdc++.h> // cu set
//// 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;
//}