Cod sursa(job #3230328)

Utilizator Ruxandra009Ruxandra Vasilescu Ruxandra009 Data 20 mai 2024 15:46:46
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.42 kb
#include <fstream>
#include <unordered_map>

using namespace std;

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

int n;
unordered_map<int, int> a;

int main()
{
    f >> n;
    for(int i = 1; i <= n; i ++)
    {
        int op, x; f >> op >> x;

        if(op == 1)
            a[x] ++;

        else if(op == 2 && a[x])
            a[x] --;

        else if(op == 3)
            g << (a[x] > 0) << '\n';
    }
    return 0;
}