Cod sursa(job #1088834)

Utilizator EpictetStamatin Cristian Epictet Data 20 ianuarie 2014 21:15:36
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;
}