Cod sursa(job #2645804)

Utilizator laur0700Laurentiu Postole laur0700 Data 29 august 2020 17:04:15
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.81 kb
#include <bits/stdc++.h>

using namespace std;

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

int main()
{
    unordered_set <int> x;
    unordered_set <int> ::iterator y;

    int n,i,aux;

    fin>>n;

    int op,nr;

    for(i=1; i<=n; i++)
    {
        fin>>op>>nr;

        if(op == 1)
        {
            x.insert(nr);
        }

        if(op == 2)
        {
            y = x.find(nr);
            if(y!=x.end())
            {
                x.erase(nr);
            }
        }

        if(op == 3)
        {
            y = x.find(nr);
            if(y!=x.end())
            {
                fout<<"1"<<"\n";
            }
            else
            {
                fout<<"0"<<"\n";
            }
        }
    }









    return 0;
}