Cod sursa(job #1347210)

Utilizator Edsger.DijkstraEdsger Wybe Dijkstra Edsger.Dijkstra Data 18 februarie 2015 20:48:49
Problema Hashuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.53 kb
#include <iostream>
#include <fstream>
#include <tr1/unordered_set>

using namespace std;

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

tr1 :: unordered_set <int> S;

int main()
{
    int N, op, x;

    in >> N;
    while (N --){
        in >> op >> x;

        if (op == 1)
            S.insert (x);
        if (op == 2)
            S.erase (x);
        if (op == 3)
            if (S.count (x))
                out << "1\n";
            else
                out << "0\n";
    }
    return 0;
}