이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |