Pagini recente » Cod sursa (job #551066) | Cod sursa (job #373663) | Cod sursa (job #1724870) | Cod sursa (job #1731681) | Cod sursa (job #1518792)
//Hashuri
#include <iostream>
#include <fstream>
#include <unordered_map>
using namespace std;
unordered_map<int, bool> ap;
void add(int x)
{
ap[ x ] = 1;
}
bool src(int x)
{
return ap[ x ];
}
void rmv(int x)
{
ap[ x ] = 0;
}
int main()
{
long long n;
int x, op;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
f>>n;
for(int i=1;i<=n;i++)
{
f >> op >> x;
if(op==1)
add(x);
if(op==2)
rmv(x);
if(op==3)
g <<((src(x)>0)?1:0)<<endl;
}
return 0;
}