Pagini recente » Cod sursa (job #558384) | Cod sursa (job #2773227) | Cod sursa (job #2770209) | Cod sursa (job #1881407) | Cod sursa (job #2908452)
#include <iostream>
#include <unordered_map>
#include <fstream>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
unordered_map <int,int> my_map;
int main()
{
int n;
int op,x;
fin>>n;
for(int i=1;i <= n; i++)
{
fin >> op >> x;
if(op == 1)
{
if(my_map.find(x) == my_map.end()) ///daca x nu se afla in map
{
my_map[x] = 1;
}
}
else if(op == 2)
{
if(my_map.find(x) != my_map.end())
{
my_map.erase(x);
}
}
else
{
if(my_map.find(x) != my_map.end())
fout<<1<<"\n";
else
fout<<0<<"\n";
}
}
return 0;
}