Cod sursa(job #1579798)
Utilizator | Sirboiu Codrin Codrin09 | Data | 25 ianuarie 2016 08:52:36 |
---|---|---|---|
Problema | Hashuri | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.6 kb |
#include <iostream>
#include <fstream>
#include <unordered_set>
using namespace std;
unordered_set <int>S;
int has,n,i,x,s;
int main()
{
ifstream f("hashuri.in");
ofstream g("hashuri.out");
f>>n;
for(i=1;i<=n;i++)
{
f>>x;
if(x==1)
{
f>>s;
S.insert(s);
}
if (x==2)
{
f>>s;
S.erase(s);
}
if (x==3)
{
f>>s;
if (S.find(s)!=S.end())g<<1<<'\n';
else g<<0<<'\n';
}
}
f.close();
g.close();
}