Pagini recente » Cod sursa (job #1375366) | Cod sursa (job #3213015) | Cod sursa (job #2384774) | Cod sursa (job #2777060) | Cod sursa (job #1528973)
#include <fstream>
#include <unordered_set>
using namespace std;
int main()
{
int N, x, op, i;
unordered_set<int> h;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
f >> N;
for (i = 0; i < N; i++)
{
f >> op;
switch(op)
{
case 1:
f >> x;
h.insert(x);
break;
case 2:
f >> x;
h.erase(x);
break;
case 3:
f >> x;
if (h.find(x) != h.end())
g << 1;
else
g << 0;
g << '\n';
break;
}
}
f.close();
g.close();
return 0;
}