Pagini recente » Cod sursa (job #496392) | Cod sursa (job #232678) | Cod sursa (job #2862033) | Cod sursa (job #1912789) | Cod sursa (job #1195926)
/*#include <map>
#include <stdio.h>
using namespace std;
int N,op,x;
map <int,int> M;
int main()
{
freopen("hashuri.in", "r",stdin);
freopen("hashuri.out", "w" , stdout);
scanf("%d ",&N);
for (int i=1; i<=N ; i++)
{
scanf("%d %d",&op,&x);
if (op == 1 && M.find(x) == M.end()) M[x] = x;
if (op == 2 ) M.erase(x);
if (op == 3 ) printf("%d\n",M.find(x) != M.end());
}
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;
}