Cod sursa(job #2450176)

Utilizator ejoi2019Ejoi 2019 ejoi2019 Data 22 august 2019 11:33:15
Problema Hashuri Scor 30
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.57 kb
#include <cstdio>
#include <set>


using namespace std;

const int MO=(int)1e9/(1<<20)+10;
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/(1<<20);
                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;
}