Cod sursa(job #2417574)

Utilizator alexoloieriAlexandru Oloieri alexoloieri Data 30 aprilie 2019 14:24:06
Problema Hashuri Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.57 kb
#include <bits/stdc++.h>
using namespace std;
int n, t, x;
unordered_set<int>st;
int main()
{
    freopen("hashuri.in","r",stdin);
    freopen("hashuri.out","w",stdout);
    scanf("%d",&n);
    for (int i=1;i<=n;++i)
    {
        scanf("%d %d",&t,&x);
        if (t == 1)
            st.insert(x);
        else
        if (t == 2)
            st.erase(x);
        else
        {
            if (st.count(x))
                printf("1\n");
            else
                printf("0\n");
        }
    }
    fclose(stdin);
    fclose(stdout);
    return 0;
}