Pagini recente » Cod sursa (job #1272427) | Cod sursa (job #1355452) | Cod sursa (job #2957902) | Cod sursa (job #2678119) | Cod sursa (job #1429777)
#include <iostream>
#include <fstream>
#include <unordered_map>
using namespace std;
ifstream in("hashuri.in");
ofstream out("hashuri.out");
int main()
{
int N, type, x, value = 0;
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] = ++value;
if (type == 2 && hashTable.find(x) != hashTable.end()) hashTable.erase(x);
if (type == 3) out << (hashTable.find(x) != hashTable.end()) << '\n';
}
return 0;
}