Cod sursa(job #2330625)

Utilizator DariusDCDarius Capolna DariusDC Data 28 ianuarie 2019 17:53:51
Problema Hashuri Scor 0
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.71 kb
#include <iostream>
#include <fstream>
#include <unordered_map>

using namespace std;

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

unordered_map <int,int> mp;

int main()
{
    int n;
    fin >> n;
    while (n--)
    {
        int tip;
        fin >> tip;
        if (tip == 1)
        {
            int x;
            fin >> x;
            mp[x]++;
        }
        else if (tip == 2)
        {
            int x;
            fin >> x;
            mp[x].erase();
        }
        else{
            int x;
            fin >> x;
            if (mp[x])
                fout << "1\n";
            else
                fout << "0\n";
        }
    }
    return 0;
}