Cod sursa(job #2559389)

Utilizator zanugMatyas Gergely zanug Data 27 februarie 2020 11:54:20
Problema Hashuri Scor 0
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.63 kb
#include <iostream>
#include <unordered_map>
#include <fstream>

using namespace std;

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

int main()
{
    int n;
    fin >> n;
    unordered_map <int, bool> x;
    for(int i = 0; i < n; ++i)
    {
        int a, szam;
        fin >> a >> szam;
        if(a == 1)
        {
            x[szam] = 1;
        }
        else if (a == 2)
        {
            x.erase(x);
        }
        else
        {
            if(x[szam] == 1)
                fout << 1 << '\n';
            else
                fout << 0 << '\n';
        }
    }
    return 0;
}