제출 #971250

#제출 시각아이디문제언어결과실행 시간메모리
971250LudisseyIntercastellar (JOI22_ho_t1)C++14
100 / 100
59 ms9360 KiB
#include <bits/stdc++.h>
#define int long long
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
 
using namespace std;

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
    int n; cin >>n;
    vector<int> a(n);
    vector<int> sze(n,1);
    for (int i = 0; i < n; i++) cin  >> a[i];
    for (int i = 0; i < n; i++)
    {
        while(a[i]%2==0) {
          sze[i]*=2;
          a[i]=a[i]/2;
        }
        if(i>0) sze[i]+=sze[i-1];
    }
    int q; cin >> q;
    while(q--){
        int x; cin >> x;
        int ans=lower_bound(sze.begin(),sze.end(),x)-sze.begin();
        cout << a[ans] << "\n";
    }
    
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...