Cod sursa(job #3132039)

Utilizator LazarDanielGabrielLazar Daniel-Gabriel LazarDanielGabriel Data 21 mai 2023 22:53:43
Problema Hashuri Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.72 kb
#include <bits/stdc++.h>
using namespace std;
ifstream fin("hashuri.in"); ofstream fout("hashuri.out");
int n, x, y;
vector<unordered_set<int>> valori;
int main() {
    valori.resize(666041);
    fin >> n;
    while (n--) {
        fin >> x >> y;
        int aux = y % 666041;

        if (x == 1) {
            if (valori[aux].count(y) == 0) {
                valori[aux].insert(y);
            }
        } else if (x == 2) {
            if (valori[aux].count(y) != 0) {
                valori[aux].erase(y);
            }
        } else if (x == 3) {
            bool rez = (valori[aux].count(y) != 0);
            fout << rez << '\n';
        }
    }

    fin.close();
    fout.close();
    return 0;
}