Cod sursa(job #2745647)

Utilizator GhiuzanuEdward Ghiuzan Ghiuzanu Data 26 aprilie 2021 21:04:59
Problema Hashuri Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.56 kb
#include <iostream>
#include <fstream>
#include <unordered_map>
using namespace std;

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

unordered_map<int, int> hashuri;
int n,y;
long long x;

int main()

{
    fin>>n;
    for(int i=1;i<=n;i++)
    {
        fin>>y>>x;
        if(y == 1)
        { hashuri[x]=1; }
        else if(y == 2)
        {  hashuri.erase(x); }
        else if(y == 3)
        {
            if(hashuri.find(x) != hashuri.end())
                fout<<1<<endl;
            else
                fout<<0<<endl;
        }
    }
    return 0;
}