Cod sursa(job #3140980)

Utilizator MihaiBunBunget Mihai MihaiBun Data 11 iulie 2023 15:46:19
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.45 kb
#include <fstream>
#include <set>

using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
int n,i,t,x;
set<int> s;
set<int>::iterator it;

int main()
{
    f >> n;
    for(i = 1; i <= n; i++)
    {
        f >> t >> x;
        if(t==1)  s.insert(x);
        else if(t==2) {it = s.find(x); if(it!=s.end())s.erase(it);}
             else {it = s.find(x); if(it!=s.end())g << "1\n"; else g << "0\n";}
    }
    return 0;
}