Cod sursa(job #2571139)

Utilizator FrostfireMagirescu Tudor Frostfire Data 4 martie 2020 21:13:30
Problema Hashuri Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.52 kb
#include <iostream>
#include <fstream>
#include <unordered_map>

using namespace std;

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

int q;
unordered_map <int, int> umap;

int main()
{
    f >> q;
    while(q--)
        {   int type, x;
            f >> type >> x;
            if(type == 1) umap[x] = 1;
            else if(type == 2) umap[x] = 0;
            else
                {   if(umap[x]) g << 1 << '\n';
                    else g << 0 << '\n';
                }
        }
    return 0;
}