Cod sursa(job #3143746)

Utilizator AlexPlesescuAlexPlesescu AlexPlesescu Data 1 august 2023 21:49:50
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.64 kb
#include <bits/stdc++.h>

using namespace std;

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

int n,x,nr;
int main()
{
    unordered_set<int> h;
    fin >> n;
    for(int i=1; i <= n; i++)
    {
        fin >> x >> nr;
        if(x == 1 || x == 2)
        {
            if(x == 1)
            {
                h.insert(nr);
            }
            else
            {
                h.erase(nr);
            }
        }
        else
        {
            if(h.find(nr) == h.end())
                fout << 0 << '\n';
            else
                fout << 1 << '\n';
        }
    }
    return 0;
}