Pagini recente » Cod sursa (job #2564171) | Cod sursa (job #1042035) | Cod sursa (job #110726) | Cod sursa (job #1592011) | Cod sursa (job #449909)
Cod sursa(job #449909)
#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) << "\n";
break;
}
}
fin.close();
fout.close();
return 0;
}