Cod sursa(job #2606987)

Utilizator avtobusAvtobus avtobus Data 28 aprilie 2020 23:45:35
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.7 kb
#include <stdio.h>
#include <bits/stdc++.h>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int INF = 0x3f3f3f3f;

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

int main(void) {
  // freopen("hashuri.in", "r", stdin);
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(NULL);
  unordered_set<int> nums;
  int n, q, x;
  fin >> n;
  rep(i, n) {
    fin >> q >> x;
    switch(q) {
      case 1:
        nums.insert(x);
        break;
      case 2:
        nums.erase(x);
        break;
      case 3:
        fout << (nums.find(x) != nums.end()) << '\n';
        break;
    }
  }

  return 0;
}