Cod sursa(job #2404193)

Utilizator ezioconnorVlad - Gabriel Iftimescu ezioconnor Data 12 aprilie 2019 13:21:55
Problema Hashuri Scor 20
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.56 kb
#include <bits/stdc++.h>

using namespace std;

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

int k;
map <int, int> m;

int main()
{
    int n, p, a;
    in >> n;
    for (int i = 1; i <= n; ++i)
    {
        in >> p >> a;
        if (p == 1 && m.find(a) == m.end())
            m[a] = ++k;
        else if (p == 2)
            m.erase(a);
        else
        {
            if (m.find(a) == m.end())
                out << 0;
            else
                out << 1;
            out << '\n';
        }
    }
    return 0;
}