Cod sursa(job #2058339)

Utilizator papinub2Papa Valentin papinub2 Data 5 noiembrie 2017 15:04:36
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.66 kb
#include <fstream>
#include <unordered_map>

using namespace std;

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

int n, x, op;
unordered_map <int, bool> v;

int main()
{
    in >> n;

    for (int i = 1; i <= n; i++)
    {
        in >> op >> x;

        if (op == 1)
        {
            if (v[x] == 0)
                v[x] = 1;
        }

        else

        if (op == 2)
        {
            if (v[x] == 1)
                v[x] = 0;
        }

        else

        {
            if (v[x] == 1)
                out << 1 << '\n';
            else
                out << 0 << '\n';
        }
    }

    return 0;
}