Cod sursa(job #2274862)

Utilizator LivcristiTerebes Liviu Livcristi Data 2 noiembrie 2018 16:44:26
Problema Hashuri Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.53 kb
#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
unordered_map <int, int> m;
int n, op, val;
int main()
{
    ifstream f("hashuri.in");
    ofstream g("hashuri.out");
    f >> n;
    for(int i = 0; i < n; ++i)
    {
        f >> op >> val;
        if(op == 1 && m.find(val) == m.end())
        {
            m[val]++;
        }
        if(op == 2)
        {
            m.erase(val);
        }
        if(op == 3)
        {
            g << (m.find(val) != m.end()) << "\n";
        }
    }
}