# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
703250 | MilosMilutinovic | Intercastellar (JOI22_ho_t1) | C++14 | 86 ms | 10156 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/**
* 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;
}
컴파일 시 표준 에러 (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... |