Cod sursa(job #2755619)

Utilizator lahayonTester lahayon Data 27 mai 2021 19:53:15
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.8 kb
#include <fstream>
#include <unordered_set>


using namespace std;



int main()
{  

    ifstream cin("hashuri.in");
    ofstream cout("hashuri.out");

    int queries, operation, value;
    cin >> queries;

    unordered_set<int> hashtable;

    while(queries--){

        cin >> operation >> value;
        switch(operation){
            case 1:
                hashtable.insert(value);
                break;
            case 2:
                hashtable.erase(value);
                break;
            case 3:
                if(hashtable.find(value) != hashtable.end()) cout << 1 << "\n";
                else cout << 0 << "\n";
                break;
            default:
                break;
        }
    }

    cin.close();
    cout.close();

  return 0;
}