Cod sursa(job #1375601)

Utilizator bogdanboboc97Bogdan Boboc bogdanboboc97 Data 5 martie 2015 13:44:09
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.44 kb
#include <bits/stdc++.h>
using namespace std;
ifstream in("hashuri.in");
ofstream out("hashuri.out");
set<int> s;
int n,t,x;
int main()
{
    for(in>>n;n;n--)
    {
        in>>t>>x;
        if(t==1)s.insert(x);
        else{
            set<int>::iterator pos=s.lower_bound(x);
            if(t==2){
                if(*pos==x)
                s.erase(pos);
            }
            else out<<(*pos==x ? 1 : 0)<<'\n';
        }
    }
    return 0;
}