Cod sursa(job #734882)

Utilizator vladstoickvladstoick vladstoick Data 15 aprilie 2012 09:21:55
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.55 kb
#include<fstream>
#include<set>
using namespace std;
set <int> hs;
ifstream in("hashuri.in");
ofstream out("hashuri.out");
int n,tip,x;
int main()
{    in>>n;
    for(int i=1;i<=n;i++)
    {
        in>>tip>>x;
        switch(tip)
        {
            case 1:{
                hs.insert(x);
                break;
            }
            case 2:{
                hs.erase(x);
                break;
            }
            case 3:{
                out<<hs.count(x)<<"\n";
                break;
            }
        }
    }
}