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;
using ll = long long;
#define MAXN (1000005)
int main() {
ios_base::sync_with_stdio(false);cin.tie(0);
ll N;
cin>>N;
ll arr[N];
for(ll i = 0;i < N;i++){
cin>>arr[i];
}
ll A[N];
ll end[N];
for(ll i = 0;i < N;i++){
ll cnt = 0;
ll a = arr[i];
while(a % 2 == 0){
a /= 2;
cnt++;
}
A[i] = (1ll<<cnt);
end[i] = a;
}
ll ptr = 0;
ll Q;
cin>>Q;
ll total = A[0];
for(ll q = 0;q < Q;q++){
ll X;
cin>>X;
while(total < X){
ptr++;
total += A[ptr];
}
cout<<end[ptr]<<'\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... |