Cod sursa(job #2757285)

Utilizator gabrielinelusGabriel-Robert Inelus gabrielinelus Data 4 iunie 2021 21:04:14
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.48 kb
#include <fstream>
#include <unordered_set>

using namespace std;

unordered_set<int> Hash;

int main()
{

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

  fin.sync_with_stdio(false);
  fin.tie(0);
  

  int N, op, x;
  fin >> N;
  for (int i = 0; i < N; ++i) {
    fin >> op >> x;
    if (op == 1) {
      Hash.insert(x);
      continue;
    }
    if (op == 2) {
      Hash.erase(x);
      continue;
    }
    fout << (Hash.find(x) != Hash.end()) << "\n";
  }
  
  return 0;
}