Cod sursa(job #1901512)

Utilizator roxannemafteiuMafteiu-Scai Roxana roxannemafteiu Data 4 martie 2017 00:18:58
Problema Hashuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.53 kb
#include <bits/stdc++.h>

using namespace std;

int N;
unordered_map <int, int> hashed;

int main() {
    ifstream fin("hashuri.in");
    ofstream fout("hashuri.out");

    fin >> N;
    while (N--) {
        int type, number;
        fin >> type >> number;
        if (type == 1 && hashed.find(number) == hashed.end()) hashed[number] = 1;
        if (type == 2) hashed.erase(number);
        if (type == 3) fout << (hashed.find(number) != hashed.end()) << '\n';
    }

    fin.close();
    fout.close();

    return 0;
}