Cod sursa(job #2645319)

Utilizator i_0__0_iNaimul i_0__0_i Data 27 august 2020 19:15:20
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.46 kb
#include <bits/stdc++.h>
using namespace std;

int32_t main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    freopen("hashuri.in", "r", stdin);
    freopen("hashuri.out", "w", stdout);
    int n; cin >> n;
    unordered_set<int> st;
    while (n--) {
        int q, x; cin >> q >> x;
        if (q == 1) st.insert(x);
        else if (q == 2 && st.count(x)) st.erase(x);
        else if (q == 3) cout << st.count(x) << '\n';
    }
    return 0;
}