Cod sursa(job #1669317)

Utilizator tudormaximTudor Maxim tudormaxim Data 30 martie 2016 17:25:30
Problema Hashuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.54 kb
#include <iostream>
#include <fstream>
#include <unordered_set>
using namespace std;

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

unordered_set <int> h;

int main() {
    ios_base::sync_with_stdio(false);
    int op, n, x;
    fin >> n;
    while(n--) {
        fin >> op >> x;
        if(op==1) h.insert(x);
        if(op==2) h.erase(x);
        if(op==3) {
            if(h.count(x) > 0) fout <<  "1\n";
            else fout << "0\n";
        }
    }
    fin.close();
    fout.close();
    return 0;
}