Cod sursa(job #2745815)

Utilizator NSA-16Neacsu-Tranciuc Sasa-Andrei NSA-16 Data 27 aprilie 2021 00:30:11
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.71 kb
#include <fstream>
#include <unordered_map>
using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
int n, k, v;
unordered_map <int, int> map;
int main()
{
    f >> n;
    for (int c = 0; c < n; c++)
    {
        f >> k >> v;
        if (k == 1)
        {
            if (map.find(v) == map.end())
            {
                map[v] = 1;
            }
        }
        if (k == 2)
        {
            map.erase(v);
        }
        if (k == 3)
        {
            if (map.find(v) != map.end())
            {
                g << 1 << "\n";
            }
            else
            {
                g << 0 << "\n";
            }
        }
    }
    return 0;
}