Pagini recente » Cod sursa (job #2321133) | Cod sursa (job #1098490) | Cod sursa (job #2190610) | Cod sursa (job #1792375) | 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--;
}
}