Cod sursa(job #2988558)

Utilizator matwudemagogul matwu Data 4 martie 2023 21:23:53
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.67 kb
#include <bits/stdc++.h>
using namespace std;
const int mod1 = 1e9 + 7, mod2 = 1e9 + 13;
set<double> s;
int main(){
    cin.tie(0)->sync_with_stdio(0);
    ifstream fin("hashuri.in");
    ofstream fout("hashuri.out");
    int n;
    fin >> n;

    while(n--){
        int t, x;
        fin >> t >> x;
        double lg = log2(x);
        if(t == 1){
            s.insert(lg);
        }
        else if(t == 2){
            s.erase(lg);
        }
        else{
            auto it = s.find(lg);
            if(it != s.end()){
                fout << 1 << '\n';
            }
            else{
                fout << 0 << '\n';
            }
        }
    }
}