# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
703250 | MilosMilutinovic | Intercastellar (JOI22_ho_t1) | C++14 | 86 ms | 10156 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/**
* author: wxhtzdy
* created: 26.02.2023 19:09:42
**/
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
vector<pair<long long, int>> f;
f.emplace_back(0, 0);
for (int i = 0; i < n; i++) {
int x = a[i];
while (x % 2 == 0) {
x /= 2;
}
f.emplace_back(f.back().first + a[i] / x, x);
}
int q;
cin >> q;
while (q--) {
long long x;
cin >> x;
int low = 0, high = f.size() - 1, pos = 0;
while (low <= high) {
int mid = low + high >> 1;
if (f[mid].first >= x) {
pos = mid;
high = mid - 1;
} else {
low = mid + 1;
}
}
cout << f[pos].second << '\n';
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |