Cod sursa(job #2793201)

Utilizator amcbnCiobanu Andrei Mihai amcbn Data 3 noiembrie 2021 11:45:44
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.65 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;

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