Cod sursa(job #3246298)

Utilizator Andrei24543Andrei Hulubei Andrei24543 Data 2 octombrie 2024 17:44:54
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.51 kb
#include <bits/stdc++.h>
using namespace std;

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

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

int main()
{
    int x;
    fin >> n;
    while(n--)
    {
        fin >> op >> x;
        if(op == 1) M[x]++;
        else if(op == 2) M.erase(x);
            else if(M.find(x) != M.end()) fout << "1\n";
                else fout << "0\n" ;
    }
    return 0;
}
/**
5 3
4 -2 2 = 0
3 -1 5 = 3
2 0 -3 = -5
4 1 -3 = -8
5 -3 2 = 0
-------
1 1 0
*/