Cod sursa(job #1798513)

Utilizator calinlixandruLixandru Calin-Mihai calinlixandru Data 5 noiembrie 2016 11:43:55
Problema Hashuri Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.64 kb
#include <iostream>
using namespace std;
#include <set>
set < int > s;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
int n,i,y,x;
int main()
{
    fin>>n;
    for(i=0;i<n;i++)
    {
        fin>>x;
        if(x==1)
            {
                fin>>y;
                s.insert(y);
            }
       if(x==2)
            {
                fin>>y;
                s.erase(y);
            }
        if(x==3)
            {
                fin>>y;
                if(s.find(y)!=s.end())
                    fout<<1<<endl;
                else
                    fout<<0<<endl;
            }
    }
    return 0;
}