Cod sursa(job #2892229)
Utilizator | Data | 21 aprilie 2022 13:20:31 | |
---|---|---|---|
Problema | Hashuri | Scor | 70 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.52 kb |
#include <iostream>
#include <fstream>
#include <set>
using namespace std;
set <int> myset;
int n,c,x;
int main()
{
ifstream f ("hashuri.in");
ofstream g ("hashuri.out");
f>>n;
for (int i=1;i<=n;i++)
{
f>>c>>x;
if (c==1)
myset.insert(x);
else if (c==2)
myset.erase(x);
else
{
set <int> :: iterator it=myset.find(x);
if (it!=myset.end()) g<<1<<'\n';
else g<<0<<'\n';
}
}
}