Cod sursa(job #1243700)
| Utilizator | Data | 16 octombrie 2014 11:12:12 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 70 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.51 kb |
#include <iostream>
#include <fstream>
#include <map>
using namespace std;
ifstream f ("hashuri.in");
ofstream g ("hashuri.out");
const int NMAX = 1000000;
int n;
map <int, int> M;
void rezolva() {
int tip, x, id = 0;
while (n--) {
f >> tip >> x;
if (tip == 1) {
if (M.find(x) == M.end()) M[x] = ++id;
}
else if (tip == 2) M.erase(x);
else if (tip == 3) g << (M.find(x) != M.end()) << '\n';
}
}
int main() {
f >> n;
rezolva();
return 0;
}
