Cod sursa(job #1895524)

Utilizator cristicretancristi cretan cristicretan Data 28 februarie 2017 00:04:25
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.49 kb
#include <bits/stdc++.h>
#define NMax 1000001
#define mod 666013
using namespace std;

ifstream f("hashuri.in");
ofstream g("hashuri.out");

int foo, n, x, nr;
map<int, int> M;

int main()
{
    f >> n;
    for(int i = 1; i <= n; ++i)
    {
        f >> foo >> x;
        if(foo == 1 && M.find(x) == M.end()) M[x] = ++nr;
        if(foo == 2) M.erase(x);
        if(foo == 3 && M.find(x) != M.end()) g << 1 << '\n';
        else if(foo == 3) g << 0 << '\n';
    }
    return 0;
}