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>
#define iter(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<ll> c(n + 1), v(n + 1);
for(int i = 1; i <= n; i++){
ll a;
cin >> a;
c[i] = 1;
while(a % 2 == 0){
a /= 2;
c[i] *= 2;
}
v[i] = a;
c[i] += c[i - 1];
}
int q;
cin >> q;
while(q--){
ll x;
cin >> x;
int pos = lower_bound(iter(c), x) - c.begin();
cout << v[pos] << "\n";
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |