Cod sursa(job #2119749)

Utilizator UWantMyNameGheorghe Vlad Camil UWantMyName Data 1 februarie 2018 16:46:26
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.5 kb
#include <bits/stdc++.h>
#define in "hashuri.in"
#define out "hashuri.out"
using namespace std;

int N, NR;
map <int, int> M;

int main()
{
    freopen(in, "r", stdin);
    freopen(out, "w", stdout);

    int i, tip, x;

    scanf("%d ", &N);
    for (i = 1; i <= N; i++)
    {
        scanf("%d %d ", &tip, &x);

        if (tip == 1 && M.find(x)==M.end()) M[x] = ++NR;
        if (tip == 2) M.erase(x);
        if (tip == 3) printf("%d\n", M.find(x) != M.end());
    }

    return 0;
}