Cod sursa(job #2682545)

Utilizator andrei.florea0405Florea Andrei-Bogdan andrei.florea0405 Data 8 decembrie 2020 21:11:15
Problema Hashuri Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.84 kb
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define MOD 1000000007

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef double ld;

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

struct Hash{
  size_t operator()(const int &x) const {
      return x % MOD;
  }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    fin >> n;
    unordered_map<int, bool, Hash> umap;


    while (n--) {
        int op, x;
        fin >> op >> x;
        if (op == 1) {
            umap[x] = true;
        } else if (op == 2) {
            umap[x] = false;
        } else {
            fout << (int)umap[x] << "\n";
        }
    }
    
    return 0;
}