Cod sursa(job #1264425)
| Utilizator | Data | 15 noiembrie 2014 19:59:07 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 70 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.53 kb |
#include <fstream>
#include <map>
using namespace std;
map<int, int> h;
int main()
{
int i, n, x, op;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
fin >> n;
for (i = 1; i <= n; ++i)
{
fin >> op >>x;
if (op == 1)
{
if (h.find(x) == h.end()) h[x] = 1;
}
else if (op == 2) h.erase(x);
else if (h.find(x) == h.end()) fout << "0\n";
else fout << "1\n";
}
fin.close();
fout.close();
return 0;
}
