Cod sursa(job #1964365)

Utilizator nedelcu11Nedelcu Mihai Vlad nedelcu11 Data 13 aprilie 2017 13:12:50
Problema Hashuri Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.39 kb
#include <fstream>
#include <map>
using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
int N, NR;
map <int, int> M;
int main()
{   int i, tip, x;
    f>>N;
    for (i=1;i<=N;i++)
    {   f>>tip>>x;
        if (tip == 1 and M.find(x)==M.end()) M[x]=++NR;
        if (tip == 2) M.erase(x);
        if (tip == 3) g<<(M.find(x)!=M.end());
    }
    return 0;
}