Cod sursa(job #1706631)
| Utilizator | Data | 22 mai 2016 22:04:11 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 60 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.46 kb |
#include <unordered_map>
#include <iostream>
#include <fstream>
std::ifstream f("hashuri.in");
std::ofstream g("hashuri.out");
int N, NR;
std::unordered_map <int, int> M;
int main()
{
int i, tip, x;
f>>N;
for (i = 1; i <= N; i++)
{
f>>tip>>x;
if (tip == 1 && M.find(x)==M.end()) M[x] = ++NR;
if (tip == 2) M.erase(x);
if (tip == 3) g<< (M.find(x) != M.end())<<std::endl;
}
return 0;
}