Cod sursa(job #2528985)
| Utilizator | Data | 22 ianuarie 2020 20:18:02 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 70 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.72 kb |
#include <fstream>
#include <map>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
const int NMAX = 10000000;
map <int, int> m;
map <int, int>::iterator it;
int main()
{
int n, i, k, x;
fin>>n;
for(i=1;i<=n;i++)
{
fin>>k>>x;
if(k==1)///aduagu elemet
{
if(m.find(x)==m.end())
m[x] =1;
continue;
}
if(k==2)
{
it = m.find(x);
if(it!= m.end())
m.erase(it);
continue;
}
if(k==3)
{
it = m.find(x);
if(it!=m.end())
fout<<"1"<<"\n";
else
fout<<"0"<<"\n";
}
}
return 0;
}
