Pagini recente » Cod sursa (job #419020) | Cod sursa (job #113325) | Cod sursa (job #2158051) | Solutii preONI 2007, Runda 3 | Cod sursa (job #2834328)
#include <iostream>
#include <fstream>
#include <set>
using namespace std;
ifstream f ("hashuri.in");
ofstream g ("hashuri.out");
int main()
{
set <int> Set;
int n;
f >> n;
for (int i = 1; i <= n; i++)
{
int option, x;
f >> option >> x;
switch (option)
{
case 1:
Set.insert(x);
break;
case 2:
Set.erase(x);
break;
case 3:
bool ok = false;
for (auto i = Set.begin(); i != Set.end(); i++)
{
if (*i == x)
{
g << "1\n";
ok = true;
break;
}
}
if (ok == false)
{
g << "0\n";
}
break;
}
}
}