Cod sursa(job #2899066)

Utilizator Mircea08Tomita Mircea Stefan Mircea08 Data 7 mai 2022 17:44:13
Problema Hashuri Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.75 kb
#include <fstream>
#include <map>
#include <set>
std::ifstream fin("hashuri.in");
std::ofstream fout("hashuri.out");
const int MOD = 100000;
std::map <int, std::set <int> > h;
int main() {
    int n, x;
    char op;
    fin >> n;
    while (n) {
        -- n;
        fin >> op >> x;
        switch (op) {
            case '1': {
                h[x % MOD].insert(x);
                break;
            }
            case '2': {
                h[x % MOD].erase(x);
                break;
            }
            case '3': {
                if (h[x % MOD].find(x) != h[x % MOD].end())
                    fout << 1 << '\n';
                else
                    fout << 0 << '\n';
            }
        }
    }
    return 0;
}