Cod sursa(job #3291593)

Utilizator cristian46290Petre Cristian cristian46290 Data 5 aprilie 2025 10:08:54
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda cex_9 Marime 0.49 kb
#include <iostream>
#include <fstream>
#include <algorithm>
#include <unordered_map>

std::ifstream f("hashuri.in");
std::ofstream g("hashuri.out");

using namespace std;

const int nMax = 1e6 + 5;

int n;
int a[nMax];

unordered_map<int,int> m;

int main()
{
    f >> n;
    for (int i = 1;i <= n;i++){
        int x, tip;
        f >> tip >> x;
        if (tip == 1)m[x]++;
        else if (tip == 2)m[x]--;
        else (m[x] > 0) ? g << 1 << '\n' : g << 0 << '\n';
    }
}