Cod sursa(job #2702855)

Utilizator MateGMGozner Mate MateGM Data 6 februarie 2021 08:49:09
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.57 kb
#include <fstream>
#include <cstdio>
#include<unordered_map>
using namespace std;

int main()
{
    freopen("hashuri.in","r",stdin);
    freopen("hashuri.out","w",stdout);
    unordered_map<int,int>m(1000000);
    int n,db=0;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        int x,y;
        scanf("%d %d",&x,&y);
        if(x==1 && m.find(y)==m.end()){
            m[y]=db++;
        }
        if(x==2)m.erase(y);
        if(x==3)
        {
            bool c=m.find(y)!=m.end();
            printf("%d\n",c);
        }
    }

    return 0;
}