Cod sursa(job #1507929)

Utilizator VisuianMihaiMihai Visuian VisuianMihai Data 22 octombrie 2015 00:39:45
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.58 kb
#include <fstream>
#include <iostream>
#include <unordered_set>

using namespace std;

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

unordered_set<int> myhash;

int main() {
    int n=1, op, val;
    fin >> n;
    for  (int i = 1; i<= n; i++ ) {
        fin >> op >> val;
        cout << op << val;
        if (op == 1) {
            myhash.insert(val);
        }
        if (op == 2) {
            myhash.erase(val);
        }
        if (op == 3) {
            fout << (myhash.find(val) != myhash.end()) <<'\n';
        }
    }
    fin.close();
    fout.close();
    return 0;
}