Cod sursa(job #3131039)

Utilizator Nicoleta114Caramaliu Nicoleta Nicoleta114 Data 19 mai 2023 01:42:00
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.48 kb
#include <iostream>
#include <unordered_set>
#include <fstream>

using namespace std;

int main() {
    unordered_set<int> hash;
    int N, op, x;
    ifstream f("hashuri.in");
    ofstream g("hashuri.out");
    f>>N;
    for(int i=0;i<N;i++)
    {
        f>>op>>x;
        if(op==1)hash.insert(x);
        else if(op==2)hash.erase(x);
        else if(op==3)
        {
            auto it = hash.find(x);
            if(it!=hash.end())g<<1<<endl;
            else g<<0<<endl;
        }
    }
}