Pagini recente » Borderou de evaluare (job #702964) | Cod sursa (job #449911)
Cod sursa(job #449911)
#include <algorithm>
#include <fstream>
#include <hash_set.h>
using namespace std;
using namespace __gnu_cxx;
typedef char cha08;
typedef int int32;
const cha08 Input[] = "hashuri.in";
const cha08 Output[] = "hashuri.out";
int32 N;
hash_set < int32, hash <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) << "\n";
break;
}
}
fin.close();
fout.close();
return 0;
}