Pagini recente » Cod sursa (job #2856914) | Cod sursa (job #994547) | Cod sursa (job #1473800) | Cod sursa (job #1229162) | Cod sursa (job #2223488)
#include <iostream>
#include <cstdio>
#include <set>
#define fs fscanf
#define fp fprintf
using namespace std;
typedef set<int>::iterator iter;
FILE *f, *g;
int n, i, x, y;
set <int> s;
void operation1(int y)
{
s.insert(y);
}
void operation2(int y)
{
iter it = s.find(y);
if(it != s.end())
s.erase(it);
}
void operation3(int y)
{
iter it = s.find(y);
if(it == s.end())
fp(g, "0\n");
else
fp(g, "1\n");
}
int main()
{
f = fopen("hashuri.in", "r");
g = fopen("hashuri.out", "w");
//set stl
fs(f, "%d", &n);
for(i = 1; i <= n; i ++)
{
fs(f, "%d%d", &x, &y);
if(x == 1)
operation1(y);
else
if(x == 2)
operation2(y);
else
if(x == 3)
operation3(y);
}
fclose(f);
fclose(g);
return 0;
}