Cod sursa(job #2737210)

Utilizator niculaandreiNicula Andrei Bogdan niculaandrei Data 4 aprilie 2021 15:34:01
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.57 kb
#include <bits/stdc++.h>

using namespace std;

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

int N, op, x;

unordered_set < int > v;

int main()
{
    fin >> N;
    for (int i = 1; i <= N; i++) {
        fin >> op >> x;
        if (op == 1) {
            v.insert(x);
        }
        else if (op == 2) {
            v.erase(x);
        }
        else {
            if (v.find(x) != v.end()) {
                fout << "1\n";
            }
            else {
                fout << "0\n";
            }
        }
    }
    return 0;
}