Cod sursa(job #496046)
| Utilizator | Data | 27 octombrie 2010 17:22:10 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 70 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.64 kb |
#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;
}
