Cod sursa(job #2639656)

Utilizator StasBrega Stanislav Stas Data 3 august 2020 13:26:59
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.61 kb
#include <bits/stdc++.h>

#define pb push_back
#define ll unsigned long long int

using namespace std;

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

unordered_set <int> s;
int n;

int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    fin >> n;

    while(n--) {
        int x, y;
        fin >> x >> y;
        auto it = s.find(y);
        bool ok = it == s.end();
        if(x==1 and ok)
            s.insert(y);
        else if(x==2 and !ok)
            s.erase(it);
        else if(x==3)
            fout << int(!ok) << "\n";
    }

	return 0;

}