Cod sursa(job #2901368)

Utilizator stefanchpStefan Chiper stefanchp Data 13 mai 2022 17:16:18
Problema Hashuri Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.59 kb
#include <bits/stdc++.h>
#include <unordered_map>
#define N 100000
using namespace std;

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

int n, x;
unordered_map <int, int> M;

int main()
{
    int op;
    fin >> n;
    for (int i = 1; i <= n; i++)
    {
        fin >> op >> x;
        if (op == 1)
        {
            M[x] = 1;
        }
        else if (op == 2)
        {
            M.erase(x);
        }
        else
        {
            if (M.find(x) != M.end()) fout << 1 << "\n";
            else fout << 0 << "\n";
        }
    }
    return 0;
}