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 int long long
signed main() {
iostream::sync_with_stdio(false);
cin.tie(nullptr);cout.tie(nullptr);
int n;cin >> n;
vector<int> a(n);
for(auto &e : a)cin >> e;
vector<int> num(n);
for(int i = 0;i<n;i++){
int c = 0;
while(a[i]%2 == 0){
c++;
a[i] /= 2;
}
num[i] = (1 << c);
}
// for(auto e : a)
// cout << e << " ";
// cout << "\n";
for(int i = 1;i<n;i++)
num[i] += num[i - 1];
// for(auto e : num)
// cout << e << " ";
// cout << "\n";
int q;cin >> q;
while(q--){
int c;cin >> c;
auto x = lower_bound(num.begin(),num.end(),c) - num.begin();
cout << a[x] << "\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... |