Cod sursa(job #1195876)
| Utilizator | Data | 8 iunie 2014 11:27:18 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.5 kb |
#include <iostream>
#include <fstream>
#include <map>
using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
int N,op,x;
map <int,int> hash;
int main()
{
f >> N;
for (int i=1; i<=N ; i++)
{
f >> op >> x;
if (op == 1 && hash.find(x) == hash.end()) hash.insert(make_pair(x,1));
if (op == 2 && hash.find(x) != hash.end()) hash.erase(x);
if (op == 3 ) g << (hash.find(x) != hash.end()) << '\n';
}
return 0;
}
