Cod sursa(job #449908)

Utilizator ssergiussSergiu-Ioan Ungur ssergiuss Data 7 mai 2010 09:17:09
Problema Hashuri Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.79 kb
#include <algorithm>
#include <fstream>
#include <tr1/unordered_set>

using namespace std;
using namespace tr1;

typedef char cha08;
typedef int int32;

const cha08 Input[] = "hashuri.in";
const cha08 Output[] = "hashuri.out";

int32 N;
unordered_set <int32> h;

int32 main() {

    ifstream fin( Input );
    ofstream fout( Output );

    int32 tip, val;

    fin >> N;

    while( N-- ) {

        fin >> tip >> val;

        switch( tip ) {

            case 1:
                h.insert( val );
                break;
            case 2:
                h.erase( val );
                break;
            case 3:
                fout << (h.find( val ) != h.end() ? 1 : 0);
                break;
        }

    fin.close();
    fout.close();

    return 0;
}