Pagini recente » Cod sursa (job #2869816) | Cod sursa (job #1758656) | Cod sursa (job #496435) | Cod sursa (job #1804864) | Cod sursa (job #3132387)
#include <bits/stdc++.h>
using namespace std;
set<int>S;
set<int>::iterator it;
int op, x, gasit, nop;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
int main()
{
ios_base::sync_with_stdio(0);
f.tie(0);
g.tie(0);
f >> nop;
for(int i = 1; i <= nop; ++i)
{
f >> op >> x;
if(op == 1)
{
S.insert(x);
}
if(op == 2)
{
S.erase(x);
}
if(op == 3)
{
it = S.find(x);
if(it != S.end())
{
g << 1 << '\n';
}
else
{
g << 0 << '\n';
}
}
}
return 0;
}