Cod sursa(job #2737191)

Utilizator niculaandreiNicula Andrei Bogdan niculaandrei Data 4 aprilie 2021 15:10:29
Problema Hashuri Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.49 kb
#include <bits/stdc++.h>

using namespace std;

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

int N, op, x;

unordered_map < int, int > MP;

int main()
{
    fin >> N;
    for (int i = 1; i <= N; i++) {
        fin >> op >> x;
        if (op == 1) {
            MP[x]++;
        }
        else if (op == 2) {
            MP[x] = max(0, MP[x] - 1);
        }
        else if (op == 3) {
            fout << (MP[x] > 0) << "\n";
        }
    }
    return 0;
}