Cod sursa(job #3132387)
| Utilizator | Data | 22 mai 2023 16:43:56 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.71 kb |
#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;
}
