Cod sursa(job #2181413)

Utilizator NannyiMaslinca Alecsandru Mihai Nannyi Data 21 martie 2018 17:36:46
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.46 kb
#include <iostream>
#include <map>
#include <fstream>
using namespace std;

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

int n,op,elem,curent;
map<int,int>Ma;

int main()
{
    f>>n;
    while (n--)
    {
        f>>op>>elem;
        if (op==1&&Ma.find(elem)==Ma.end())
            Ma[elem]=++curent;
        if (op==2)
            Ma.erase(elem);
        if (op==3)
            g<<(Ma.find(elem)!=Ma.end())<<'\n';
    }
    return 0;
}