Pagini recente » Cod sursa (job #601414) | Cod sursa (job #848495) | Cod sursa (job #1760585) | Cod sursa (job #208360) | Cod sursa (job #1132146)
/*
/// Craciun Catalin
/// Hashuri
/// Arhiva educationala
/// www.infoarena.ro/problema/hashuri
#include <fstream>
#include <iostream>
#include <map>
using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
map<int, bool> H;
int main()
{
long n;
f>>n;
for (long i=1;i<=n;i++)
{
short tip;
long x;
f>>tip>>x;
if (tip==1)
{
if (H.find(x)==H.end())
H[x]=1;
}
else if (tip==2)
{
H.erase(x);
}
else if (tip==3)
{
if (H.find(x)!=H.end())
g<<1<<'\n';
else
g<<0<<'\n';
}
}
f.close();
g.close();
return 0;
}
*/
#include <stdio.h>
#include <map>
using namespace std;
int N, NR;
map <int, int> M;
int main()
{
freopen("hashuri.in", "r", stdin);
freopen("hashuri.out", "w", stdout);
int i, tip, x;
scanf("%d ", &N);
for (i = 1; i <= N; i++)
{
scanf("%d %d ", &tip, &x);
if (tip == 1 && M.find(x)==M.end()) M[x] = ++NR;
if (tip == 2) M.erase(x);
if (tip == 3) printf("%d\n", M.find(x) != M.end());
}
return 0;
}