제출 #1267664

#제출 시각아이디문제언어결과실행 시간메모리
1267664enzyIntercastellar (JOI22_ho_t1)C++20
100 / 100
177 ms5444 KiB
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=2e5+10;
ll v[maxn], qtd[maxn];
int main(){
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    int n; cin >> n;
    for(int i=1;i<=n;i++){
        cin >> v[i];
        for(int k=1;k<60;k++){
            ll d=(1ll<<k);
            if(v[i]%d){
                qtd[i]=k-1;
                break;
            }
        }
    }
    int q; cin >> q;
    int id=1;
    ll sum=(1ll<<qtd[1]);
    while(q--){
        ll x; cin >> x;
        while(x>sum) sum+=(1ll<<qtd[++id]);
        cout << (v[id]/(1ll<<qtd[id])) << endl;
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...