Pagini recente » Cod sursa (job #1198622) | Cod sursa (job #250323) | Cod sursa (job #1910522) | Cod sursa (job #1970249) | Cod sursa (job #1075220)
#include <stdio.h>
#include <stdlib.h>
#include <unordered_set>
int main()
{
FILE *f = fopen("hashuri.in", "r"), *g = fopen("hashuri.out", "w");
int n,x,i,op;
fscanf(f, "%d", &n);
std::unordered_set<int> hash;
for (i = 0; i < n; i++)
{
fscanf(f, "%d", &op);
fscanf(f, "%d", &x);
if (op==1)
hash.insert(x);
if (op == 2)
hash.erase(x);
if (op == 3)
{
if (hash.find(x) != hash.end())
fprintf(g, "1\n");
else fprintf(g, "0\n");
}
}
fclose(f);
fclose(g);
return 0;
}