Cod sursa(job #1528976)

Utilizator alexandru.ghergutAlexandru-Gabriel Ghergut alexandru.ghergut Data 20 noiembrie 2015 12:33:07
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.56 kb
#include <fstream>
#include <unordered_map>
using namespace std;

int main()
{
    int N, x, op, i;
    unordered_map<int, bool> h;
    ifstream f("hashuri.in");
    ofstream g("hashuri.out");

    f >> N;
    for (i = 0; i < N; i++)
    {
        f >> op;
        f >> x;
        switch(op)
        {
        case 1:
            h[x] = true;
            break;
        case 2:
            h[x] = false;
            break;
        case 3:
            g << h[x] << '\n'; // true - 1, false - 0
            break;
        }
    }

    f.close();
    g.close();
    return 0;
}