Cod sursa(job #1429894)
Utilizator | Andrei-Mario Dinu dinuand | Data | 7 mai 2015 15:00:29 |
---|---|---|---|
Problema | Hashuri | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.5 kb |
#include <iostream>
#include <fstream>
#include <unordered_map>
using namespace std;
ifstream in("hashuri.in");
ofstream out("hashuri.out");
int main()
{
int N, type, x;
unordered_map<int, int> hashTable;
in >> N;
for (int i = 1; i <= N; i++) {
in >> type >> x;
if (type == 1 && hashTable.find(x) == hashTable.end()) hashTable[x] = 1;
if (type == 2 && hashTable.find(x) != hashTable.end()) hashTable.erase(x);
if (type == 3) out << (hashTable.find(x) != hashTable.end()) << '\n';
}
return 0;
}