Pagini recente » Rating Tania Zinevici (Kayami) | Cod sursa (job #1601654) | Cod sursa (job #1817386) | Cod sursa (job #2177294) | Cod sursa (job #1429894)
#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;
}