Cod sursa(job #3321491)

Utilizator Roberto_CChirvasitu Roberto Roberto_C Data 9 noiembrie 2025 18:48:38
Problema Hashuri Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.66 kb
#include <bits/stdc++.h>
using namespace std;

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

map<int,int>fr;
int n;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    fin >> n;
    while(n--)
    {
        int op,x;
        fin >> op >> x;
        if(op == 1)
        {
            if(fr.find(x) == fr.end())
                fr[x] = 1;
        }
        else if(op == 2)
        {
            fr.erase(x);
        }
        else
        {
            if(fr.find(x) != fr.end())
                fout << 1;
            else
                fout << 0;
            fout << '\n';
        }
    }
    return 0;
}