Cod sursa(job #2389094)

Utilizator petrisorvmyVamanu Petru Gabriel petrisorvmy Data 26 martie 2019 20:08:29
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda excelenta-tema3 Marime 0.61 kb
#include <fstream>
#include <unordered_set>
using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");

unordered_set <int> myset;
unordered_set <int> :: iterator op;
int n, q ,x;
int main()
{
    f >> n;
    for(int i = 1; i <= n; ++ i)
    {
        f >> q >> x;
        if(q == 1)
        {
            myset.insert(x);
        }
        else if(q == 2)
        {
            if(myset.count(x))
                myset.erase(x);
        }
        else if(q == 3)
        {

            g << (myset.count(x)>0) << '\n';
        }
    }
    f.close(); g.close();
    return 0;
}