Cod sursa(job #1819894)

Utilizator vladm98Munteanu Vlad vladm98 Data 30 noiembrie 2016 22:31:17
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.54 kb
#include <bits/stdc++.h>

using namespace std;
map <int, int> v;
int main()
{
    ifstream fin ("hashuri.in");
    ofstream fout ("hashuri.out");
    int n, x, op, i;
    fin >> n;
    for (i = 0; i<n; ++i)
    {
        fin >> op >> x;
        if (op == 1 && v.count(x) == 0)
            v[x] = 1;
        if (op == 2 && v.count(x) == 1)
            v.erase (x);
        if (op == 3)
        {
            if (v.count(x))
                fout << 1 << '\n';
            else fout << 0 << '\n';
        }
    }
    return 0;
}