Cod sursa(job #2439529)

Utilizator DavidLDavid Lauran DavidL Data 16 iulie 2019 11:27:45
Problema Hashuri Scor 30
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.55 kb
#include <bits/stdc++.h>
#define cin fi
#define cout fo
using namespace std;
ifstream fi("hashuri.in");
ofstream fo("hashuri.out");

const int MOD = 10000019;

int n;
bool h[MOD - 1];

inline int key(int x)
{
    return x - x / MOD * MOD;
}

int main()
{
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        int op, x;
        cin >> op >> x;
        if (op == 1)
            h[key(x)] = 1;
        else if (op == 2)
            h[key(x)] = 0;
        else 
            cout << h[key(x)] << "\n";
    }

    return 0;
}