Pagini recente » Cod sursa (job #1999978) | Cod sursa (job #1481167) | Cod sursa (job #1844434) | Cod sursa (job #742888) | Cod sursa (job #1518787)
//Hashuri
#include <iostream>
#include <fstream>
#include <map>
using namespace std;
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;
}