Cod sursa(job #1120722)

Utilizator swim406Teudan Adina swim406 Data 25 februarie 2014 09:42:33
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.44 kb
#include <stdio.h>
#include <set>

using namespace std;

set <int> S;

int main() {
    freopen ("hashuri.in", "r", stdin);
    freopen ("hashuri.out", "w", stdout);
    int N, i, opt, x;
    scanf ("%d", &N);
    for (i = 1; i <= N; ++i) {
        scanf ("%d %d", &opt, &x);
        if (opt == 1) S.insert(x);
        if (opt == 2) S.erase(x);
        if (opt == 3) printf ("%d\n", S.find(x) != S.end());
    }
    return 0;
}