Cod sursa(job #1767915)

Utilizator giotoPopescu Ioan gioto Data 29 septembrie 2016 21:19:18
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.47 kb
#include <cstdio>
#include <map>
using namespace std;

map <int,int> mymap;
int n,x,caz;
int main()
{
    freopen("hashuri.in", "r", stdin);
    freopen("hashuri.out", "w", stdout);
    scanf("%d", &n);
    int nr=0;
    for(int i=1;i<=n;++i){
        scanf("%d%d", &caz,&x);
        if(caz==1&&mymap.find(x)==mymap.end()) mymap[x]=++nr;
        if(caz==2) mymap.erase(x);
        if(caz==3) printf("%d\n",mymap.find(x)!=mymap.end());

    }
    return 0;
}