Cod sursa(job #2757281)

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

using namespace std;

int main()
{

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

  fin.sync_with_stdio(false);
  fin.tie(0);
  
  int N, op, x;
  unordered_set<int> hash;

  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;
}