Cod sursa(job #1801961)

Utilizator cyber_ghSoltan Gheorghe cyber_gh Data 9 noiembrie 2016 18:50:50
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.55 kb
#include <bits/stdc++.h>

using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
set<int> s;
int n;
int main()
{
    fin>>n;
    for(int i=1;i<=n;i++){
        int index,x;
        fin>>index>>x;
        if (index==1){
            s.insert(x);
        }
        if (index==2){
            s.erase(x);
        }
        if(index==3){
            set<int>::iterator it;
            it=s.find(x);
           if (*it==x) fout <<1;
            else fout <<0;
            fout <<'\n';
        }
    }
    return 0;
}