Cod sursa(job #2701861)

Utilizator beingsebiPopa Sebastian beingsebi Data 1 februarie 2021 23:30:19
Problema Hashuri Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.96 kb
#include <bits/stdc++.h>
using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
// #define f cin
// #define g cout
struct custom_hash
{
    static uint64_t splitmix64(uint64_t x)
    {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const
    {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
unordered_map<int, bool, custom_hash> ma;
int32_t main()
{
    ios_base::sync_with_stdio(false);
    f.tie(nullptr);
    g.tie(nullptr);
    int q;
    f >> q;
    for (int c, x; q; q--)
    {
        f >> c >> x;
        if (c == 1)
            ma[x] = 1;
        else if (c == 2)
            ma[x] = 0;
        else
            g << ma[x] << '\n';
    }
    return 0;
}