Cod sursa(job #2368710)

Utilizator RussianSmoothCriminalRodion Raskolnikov RussianSmoothCriminal Data 5 martie 2019 17:26:12
Problema Hashuri Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.46 kb
#include <fstream>
#include <unordered_map>
using namespace std;

ifstream fin ("hashuri.in");
ofstream fout ("hashuri.out");

unordered_map<int, int> M;

void Solve ()
{
    int n, op, x;
    fin >> n;
    while (n--)
    {
        fin >> op >> x;
        if (op == 1 && !M[x]) M[x] = 1;
        if (op == 2 && M[x]) M[x] = 0;
        else if (op == 3) fout << M[x] << "\n";
    }
    fout.close();
}

int main()
{
    Solve();
    return 0;
}