Cod sursa(job #1579793)

Utilizator Codrin09Sirboiu Codrin Codrin09 Data 25 ianuarie 2016 08:50:56
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.58 kb
#include <iostream>
#include <fstream>
#include <set>

using namespace std;

set <int>S;

int has,n,i,x,s;

int main()
{
    ifstream f("hashuri.in");
    ofstream g("hashuri.out");
    f>>n;
    for(i=1;i<=n;i++)
    {
        f>>x;
        if(x==1)
        {
            f>>s;
            S.insert(s);
        }
       if (x==2)
       {
           f>>s;
           S.erase(s);
       }
       if (x==3)
       {
            f>>s;
            if (S.find(s)!=S.end())g<<1<<'\n';
            else g<<0<<'\n';
       }
    }

    f.close();
    g.close();
}