Pagini recente » Cod sursa (job #2724917) | Cod sursa (job #1698626) | Cod sursa (job #2866282) | Cod sursa (job #2419187) | Cod sursa (job #3141887)
#include <iostream>
#include <fstream>
#include <unordered_map>
#include <chrono>
using namespace std;
ifstream f ("hashuri.in");
ofstream g ("hashuri.out");
struct HashFunction
{
size_t inline operator()(int x) const
{
static const int FIXED_SEED = chrono :: steady_clock :: now().time_since_epoch().count();
x ^= FIXED_SEED;
return x ^ (x >> 16);
}
};
int main()
{
int n;
unordered_map <int, int, HashFunction> u_m;
f >> n;
for (int i = 1; i <= n; i++)
{
int task, x;
f >> task >> x;
if (task == 1) u_m[x] = 1;
else if (task == 2) u_m[x] = 0;
else g << ((u_m[x] == 1) ? ("1\n") : ("0\n"));
}
return 0;
}