Pagini recente » Cod sursa (job #1223939) | Rating FMI Dima Robert (sp3ct3r) | Cod sursa (job #1782325) | Cod sursa (job #2237748) | Cod sursa (job #2075074)
#include <iostream>
#include <hash_map>
#include <fstream>
using namespace std;
using namespace __gnu_cxx;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
int n, op, x;
int main()
{
hash_map<int, bool> hashTable;
fin>>n;
while (n) {
fin>>op>>x;
switch (op) {
case 1:
// hashTable[x] =1;
hashTable.insert({x, 1});
break;
case 2:
// hashTable[x] = 0;
hashTable.erase(x);
break;
case 3:
fout<<hashTable[x]<<"\n";
break;
}
n--;
}
return 0;
}