Cod sursa(job #3199288)

Utilizator panterasbook29Turcu Stiolica Alexandru panterasbook29 Data 1 februarie 2024 12:17:49
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.63 kb
#include <fstream>
#include <unordered_map>

using namespace std;

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

int n;
int x,y;

unordered_map <int, int> umap;


int main()
{
    fin>>n;
    for(int i=1;i<=n;i++)
    {
        fin>>x>>y;
        if(x==1)
        {
            umap.insert(make_pair(y, 1));
        }
        else if(x==2)
        {
            umap.erase(y);
        }
        else
        {
            if(umap.find(y) != umap.end())
            {
                fout<<1<<endl;
            }
            else
                fout<<0<<endl;
        }
    }
    return 0;
}