This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const int mxN = 2e5 + 5;
ll n,a[mxN],q,val[mxN];
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n;
for(int i = 0; i < n; i++){
cin >> a[i];
val[i] = 1;
while(a[i] % 2 == 0){
val[i] *= 2;
a[i] /= 2;
}
}
cin >> q;
ll l = 0,num = 0;
while(q--){
ll x;
cin >> x;
while(x - num > val[l]) num += val[l++];
cout << a[l] << '\n';
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |