Pagini recente » Istoria paginii problema/mesaj2 | Diferente pentru runda/oni_preg intre reviziile 2 si 1 | Diferente pentru problema/medie intre reviziile 39 si 38 | Cod sursa (job #3037986) | Cod sursa (job #1596115)
#include <iostream>
#include <set>
using namespace std;
int N, op, x;
set<int> theHash;
int main()
{
freopen("hashuri.in", "r", stdin);
freopen("hashuri.out", "w", stdout);
cin >> N;
while (N > 0)
{
cin >> op >> x;
switch (op)
{
case 1://insert value, if does not exist
theHash.insert(x);
break;
case 2://delete value, if exists
theHash.erase(x);
break;
case 3://try to find the value, and print output
cout << (theHash.find(x) != theHash.end()) << "\n";
break;
}
N--;
}
}