Cod sursa(job #1523351)

Utilizator theodor.moroianuTheodor Moroianu theodor.moroianu Data 12 noiembrie 2015 17:18:24
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.5 kb
#include <fstream>
#include <set>
using namespace std;

set <int> s;

int main(){

    ifstream in("hashuri.in");
    int n, q;
    ofstream out("hashuri.out");
    short c;
    in >> n;
    while (n--){
        in >> c >> q;
        if (c == 1)
            s.insert(q);
        if (c == 2)
            s.erase(q);
        if (c == 3 && s.find(q) != s.end())
            out << "1\n";
        if (c == 3 && s.find(q) == s.end())
            out << "0\n";
    }
    in.close();
    out.close();
    return 0;
}