Pagini recente » Istoria paginii runda/simu/clasament | Cod sursa (job #1009071) | Cod sursa (job #1547140) | Cod sursa (job #817340) | 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;
}