Pagini recente » Cod sursa (job #712482) | Cod sursa (job #20712) | Cod sursa (job #3041858) | Cod sursa (job #2704747) | Cod sursa (job #496046)
Cod sursa(job #496046)
#include <cstdio>
#include <set>
using namespace std;
#define DIM 1000005
int N = 0, v[DIM];
set<int>S;
int main()
{
int n,type, x;
FILE *f = fopen("hashuri.in", "r"), *out = fopen("hashuri.out", "w");
fscanf(f, "%d", &n);
for (;n;--n)
{
fscanf(f, "%d", &type);
fscanf(f, "%d", &x);
if (type == 1)
S.insert(x);
else
if (type == 2)
S.erase(x);
else
if (S.find(x) != S.end())
fprintf(out, "1\n");
else
fprintf(out, "0\n");
}
fclose(f);
fclose(out);
return 0;
}