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 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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |