Cod sursa(job #2793200)

Utilizator amcbnCiobanu Andrei Mihai amcbn Data 3 noiembrie 2021 11:39:11
Problema Hashuri Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.87 kb
/* [A][M][C][B][N] / [K][R][I][P][6][8] */
#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
typedef long long ll;
const char sp = ' ', nl = '\n';
const int MOD = 9973;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
unordered_map<int, int> hashMap;
vector<bool> f;
void createMap() {
    ifstream gin("hashuri.in");
    int n, x, y, sz = 0;
    gin >> n;
    while (n--) {
        gin >> x >> y;
        if (hashMap.find(y) == hashMap.end())
            hashMap[y] = sz++;
    }
    f.resize(sz);
    gin.close();
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    createMap(); 
    int n;
    fin >> n;
    while (n--) {
        int p, x;
        fin >> p >> x;
        if (p == 1) f[hashMap[x]] = 1;
        if (p == 2) f[hashMap[x]] = 0;
        if (p == 3) fout << f[hashMap[x]] << nl;
    }
}