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
using namespace std;
int32_t main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int N; cin >> N;
vector<pair<int,int>> arr;
for(int i = 0;i<N;++i){
int x; cin >> x;
int p = 1;
while(x % 2 == 0){
x /= 2; p *= 2;
}
arr.push_back({x,p});
//cout << x << " " << p << "\n";
}
int Q; cin >> Q;
int pos = 0, cur = 0;
for(int i = 0;i<Q;++i){
int a; cin >> a;
while(cur+arr[pos].second < a){
cur += arr[pos].second;
pos++;
}
cout << arr[pos].first << "\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... |