Cod sursa(job #2738975)
| Utilizator | Data | 6 aprilie 2021 17:18:34 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 70 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.63 kb |
#include <iostream>
#include <fstream>
#include <map>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
int main() {
int n, x, op;
map<int, int> m;
fin >> n;
for(int i=0; i<n; ++i)
{
fin >> op >> x;
if (op == 1)
{
if(m.count(x) == 0)
m[x] = 1;
}
else if (op == 2)
{
if(m.count(x) != 0)
m.erase(x);
}
else
{
if( m.count(x)!= 0)
fout << 1 << "\n";
else
fout << 0 << "\n";
}
}
return 0;
}