Pagini recente » Cod sursa (job #198157) | Cod sursa (job #367572) | Cod sursa (job #637518) | Cod sursa (job #544181) | Cod sursa (job #408558)
Cod sursa(job #408558)
#include <iostream>
#include <cstdio>
#include <map>
using namespace std;
int main(void)
{
FILE *f = fopen("hashuri.in", "r");
FILE *g = fopen("hashuri.out", "w");
map<int, int> m;
int N, poz = 0, op, x;
fscanf(f, "%d", &N);
for(int i = 1; i <= N; ++i)
{
fscanf(f, "%d%d", &op, &x);
if(op == 1 && m.find(x) == m.end())
m[x] = ++poz;
if(op == 2)
m.erase(x);
if(op == 3)
fprintf(g, "%d\n", m.find(x) != m.end());
}
fclose(f);
fclose(g);
return 0;
}