Cod sursa(job #3362361)

Utilizator andrei_brasoveanu7Andrei Octavian andrei_brasoveanu7 Data 7 august 2026 15:57:28
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.55 kb
#include <fstream>
#include <unordered_map>
using namespace std;
ifstream f ("hashuri.in");
ofstream g ("hashuri.out");
int main() {
    int n, op, x, cnt=0;
    f >> n;
    unordered_map <int, int> m;
    while (n--) {
        f >> op >> x;
        if (op == 1)
            m[x]=++cnt;
        if (op == 2)
            m.erase(x);
        if (op == 3)
        {
            auto it = m.find(x);
            if (it != m.end())
                g << 1 << '\n';
            else
                g << 0 << '\n';
         }
    }
    return 0;
}