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 all(v) v.begin(), v.end()
#define sz(x) (int)x.size()
#define pb push_back
#define pii pair<int, int>
#define chmin(x, v) x = min(x, v)
#define chmax(x, v) x = max(x, v)
#define print(x) cout << #x << " est " << x << endl;
#define x first
#define y second
#define int long long
using namespace std;
signed main(){
int nVals; cin >> nVals;
vector<int> vals(nVals), nPieces;
for (int& val : vals){
cin >> val;
int ordre = 1;
while (val%2 == 0){
val /= 2;
ordre *= 2;
}
if (nPieces.empty())
nPieces.pb(ordre);
else
nPieces.pb(nPieces.back() + ordre);
}
int nReqs; cin >> nReqs;
while (nReqs--){
int x; cin >> x;
int id = lower_bound(all(nPieces), x) - nPieces.begin();
// cout << "ans";
cout << vals[id] << endl;
}
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... |