Cod sursa(job #736016)

Utilizator visanrVisan Radu visanr Data 17 aprilie 2012 18:20:21
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.77 kb
#include <cstdio>
#include <cstdlib>
#include <map>
using namespace std;


map<int,int> m;
int n,x,operatie,nr=1;


int main()
{
    freopen("hashuri.in","r",stdin);
    freopen("hashuri.out","w",stdout);
    scanf("%ld", &n);
    for(int i=0;i<n;i++)
    {
            scanf("%i %i", &operatie,&x);
            switch(operatie)
            {
                            case 1: if(m.find(x)==m.end()) m[x]=nr++;
                                    break;
                            case 2: m.erase(x);
                                    break;
                            case 3: if(m.find(x)==m.end()) printf("0\n");
                                    else printf("1\n");
                                    break;
            }
    }
    return 0;
}