Cod sursa(job #1777974)

Utilizator tudorgalatanRoman Tudor tudorgalatan Data 13 octombrie 2016 09:42:26
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.54 kb
#include <fstream>
#include <set>

using namespace std;

unsigned int N;
unsigned short int op;
unsigned int x;

set < unsigned int > V;
unsigned int i;

int main ()
{
    ifstream fin ("hashuri.in");
    fin >> N;
    ofstream fout ("hashuri.out");
    for (i=1; i<=N; i++)
    {
        fin >> op >> x;
        if (op == 1)
            V.insert(x);
        else if (op == 2)
            V.erase(x);
        else
            fout << (V.find(x) != V.end()) << '\n';
    }
    fin.close();
    fout.close();
    return 0;
}