Cod sursa(job #2450173)

Utilizator ejoi2019Ejoi 2019 ejoi2019 Data 22 august 2019 11:31:16
Problema Hashuri Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.55 kb
#include <cstdio>
#include <set>


using namespace std;

const int MO=(1<<20);
set <int> g[MO];

int main()
{
        freopen("hashuri.in","r",stdin);
        freopen("hashuri.out","w",stdout);
        int n;
        scanf("%d",&n);
        for(int i=1;i<=n;i++)
        {
                int t,x;
                scanf("%d%d",&t,&x);
                int h=x%MO;
                if(t==1) g[h].insert(x);
                if(t==2) g[h].erase(x);
                if(t==3) printf("%d\n",(g[h].find(x)!=g[h].end()));
        }
        return 0;
}