Cod sursa(job #2745292)

Utilizator Dantelogus99Gruia Gabriel Dantelogus99 Data 26 aprilie 2021 12:28:16
Problema Hashuri Scor 0
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.58 kb
#include <iostream>
#include <fstream>
#include <set>
using namespace std;

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

set<unsigned int> hash1;
unsigned int n, op, x;

int main()
{
    fin >> n;

    for (int i = n; i > 0; i++)
    {
        fin >> op >> x;

        if (op == 1)
            hash1.insert(x);
        else
            if (op == 2)
                hash1.erase(x);
            else
                if (hash1.find(x) != hash1.end())
                    fout << "1\n";
                else
                    fout << "0\n";
    }
}