Cod sursa(job #1803454)
Utilizator | Coman Claudiu comanclaudiu14 | Data | 11 noiembrie 2016 15:00:14 |
---|---|---|---|
Problema | Hashuri | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.78 kb |
#include <fstream>
using namespace std;
#include <unordered_set>
fstream fin("hashuri.in");
ofstream fout("hashuri.out");
unordered_set < int > s;
int i,op,x,n;
int main()
{
fin>>n;
for(i=0;i<n;i++)
{
fin>>op>>x;
if(op==1)
{
s.insert(x);
}
else
{
if(op==2)
s.erase(x);
else
{
if(op==3)
{
if(s.find(x)==s.end())
{
fout<<0<<endl;
}
else
{
fout<<1<<endl;
}
}
}
}
}
fin.close();fout.close();
return 0;
}