Cod sursa(job #2781874)

Utilizator ionanghelinaIonut Anghelina ionanghelina Data 10 octombrie 2021 19:10:38
Problema Hashuri Scor 10
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.71 kb
#include <iostream>
#include <unordered_map>
#include <fstream>

using namespace std;

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

unordered_map <int,int> H;

int main()
{
    long long n,a,b;
    fin>>n;
    for(int i = 1; i<=n; i++)
    {
        fin>>a;
        fin>>b;
        if(a == 1)
            H[b] = 1;
        else
        {
            if(a == 2)
                H.erase(H.find(b));
            else
            {
                if(a == 3)
                {
                    if(H.find(b) == H.end())
                        fout<<0<<'\n';
                    else
                        fout<<1<<'\n';
                }
            }
        }
    }
}