Pagini recente » Cod sursa (job #2374239) | Cod sursa (job #1245650) | Cod sursa (job #851736) | Cod sursa (job #173621) | Cod sursa (job #1448097)
#include <fstream>
#include <unordered_set>
int main()
{
std::ios_base::sync_with_stdio(false);
int number_of_operations, value;
char operation_type;
std::unordered_set<int> hash;
std::ifstream fin ("hashuri.in");
std::ofstream fout ("hashuri.out");
fin>>number_of_operations;
while (number_of_operations--)
{
fin>>operation_type>>value;
switch(operation_type)
{
case '1':
hash.insert(value);
break;
case '2':
hash.erase(value);
break;
case '3':
fout<<(hash.find(value)!=hash.end())<<'\n';
break;
}
}
return 0;
}