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
int a[200100];
void solve(){
int n;
cin>>n;
for(int i=1; i<=n; i++){
cin>>a[i];
}
ll d=0;
int t;
cin>>t;
ll x = 1;
while(t--){
ll g;
cin>>g;
while(true){
ll k = a[x];
ll h = 1;
while(k % 2 == 0) k /= 2, h*=2;
if(g - d <= h){
cout<<k<<'\n';
break;
}
d += h;
x ++;
}
}
}
int main(){
solve();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |