Cod sursa(job #1172492)

Utilizator EpictetStamatin Cristian Epictet Data 17 aprilie 2014 16:38:19
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.4 kb
#include <fstream>
#include <map>
using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
int n,op,x,nr;
map <int, int> M;
int main()
{
    f >> n;
    for(int i=1; i<=n; i++)
    {
        f >> op >> x;
        if((op == 1) && (M.find(x) == M.end())) M[x] = ++nr;
        if (op == 2) M.erase(x);
        if (op == 3) g << (M.find(x) != M.end()) << '\n';
    }

    g.close();
    return 0;
}