Cod sursa(job #1802930)
| Utilizator | Data | 10 noiembrie 2016 20:01:52 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 70 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.75 kb |
#include <fstream>
#include <set>
using namespace std;
ifstream F ("hashuri.in");
ofstream G ("hashuri.out");
set < int > s;
int op, n, x;
int main()
{
F >> n;
for(int i = 0; i < n; ++ i)
{
F >> op >> x;
if (op == 1)
{
if (s.find(x) == s.end())
s.insert(x);
}
else
if(op == 2)
{
if (s.find(x) != s.end())
s.erase(s.find(x));
}
else
if(op == 3)
{
if (s.find(x) != s.end())
G << "1\n";
else
G << "0\n";
}
}
return 0;
}
