Cod sursa(job #2645314)

Utilizator i_0__0_iNaimul i_0__0_i Data 27 august 2020 18:44:43
Problema Hashuri Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.47 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;
    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) ? '1' : '0') << '\n';
    }
    return 0;
}