Cod sursa(job #2590914)

Utilizator gabrielinelusGabriel-Robert Inelus gabrielinelus Data 29 martie 2020 12:32:13
Problema Hashuri Scor 0
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.45 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);
  fout.sync_with_stdio(false);
  fout.tie(0);
  
  int N;
  fin >> N;
  unordered_set<int> S;
  int op, x;
  for (int i = 0; i < N; ++i) {
    fin >> op, x;
    if (op == 1) S.insert(x);
    else if (op == 2) S.erase(x);
    else fout << S.count(x) << "\n";
  }
  return 0;
}