Cod sursa(job #2257135)

Utilizator vladm98Munteanu Vlad vladm98 Data 9 octombrie 2018 18:05:50
Problema Hashuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.54 kb
#include <bits/stdc++.h>

using namespace std;

map <int, int> f[666013];

void insert (int x) {
    f[x % 666013][x] += 1;
}
void erase (int x) {
    f[x % 666013].erase(x);
}

bool find (int x) {
    return f[x % 666013].count(x) != 0;
}

int main()
{
    ifstream fin ("hashuri.in");
    ofstream fout ("hashuri.out");
    int n;
    fin >> n;
    for (int i = 1; i <= n; ++i) {
        int op, x;
        fin >> op >> x;
        if (op == 1) insert(x);
        if (op == 2) erase(x);
        if (op == 3) fout << find(x) << '\n';
    }
    return 0;
}