Cod sursa(job #1639374)
| Utilizator | Data | 8 martie 2016 12:03:08 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 70 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.52 kb |
#include <iostream>
#include <fstream>
#include <map>
using namespace std;
ifstream fin ("hashuri.in");
ofstream fout ("hashuri.out");
map <int, int> hsh;
int N, M;
int main()
{
fin >>N;
for (int i = 1; i <= N; ++i)
{
int type, x;
fin >>type >>x;
if (type == 1)
if (hsh.find(x) == hsh.end())
hsh[x] = ++M;
if (type == 2)
hsh.erase(x);
if (type == 3)
fout <<((hsh.find(x) != hsh.end()) ? (1):(0)) <<'\n';
}
fout.close();
return 0;
}
