Cod sursa(job #3250200)

Utilizator Maftei_TudorMaftei Tudor Maftei_Tudor Data 19 octombrie 2024 17:07:26
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.66 kb
#include <iostream>
#include <unordered_set>

using namespace std;

unordered_set<int> m;

int main()
{
    freopen("hashuri.in", "r", stdin);
    freopen("hashuri.out", "w", stdout);
    cin.tie(nullptr)->sync_with_stdio(0);

    int q;
    cin >> q;
    while(q--) {
        int tip;
        cin >> tip;
        if(tip == 1) {
            int x;
            cin >> x;
            m.insert(x);
        }
        else if(tip == 2) {
            int x;
            cin >> x;
            m.erase(x);
        }
        else {
            int x;
            cin >> x;
            cout << m.count(x) << '\n';
        }
    }
    return 0;
}