# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
575101 | dariasc | Intercastellar (JOI22_ho_t1) | C++14 | 331 ms | 9216 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#pragma region header
typedef long long ll;
template <typename Value>
using vec = vector<Value>;
istream &in = cin;
ostream &out = cout;
#define all(x) x.begin(), x.end()
#define fast() cin.tie(0); ios_base::sync_with_stdio(0)
#pragma endregion
void solve()
{
int n; in >> n;
vec<int> a(n);
for (int i = 0; i < n; i++) {
in >> a[i];
}
vec<int> sz(n);
for (int i = 0; i < n; i++) {
int c = 1;
int x = a[i];
while (x % 2 == 0) {
x /= 2;
c *= 2;
}
sz[i] = c;
}
vec<long long> pfx(n, 0);
pfx[0] = sz[0];
for (int i = 1; i < n; i++) {
pfx[i] = sz[i] + pfx[i-1];
}
int q; in >> q;
while (q--) {
long long x; in >> x;
int i = lower_bound(all(pfx), x) - pfx.begin();
int o = a[i];
while (o % 2 == 0) {
o /= 2;
}
out << o << endl;
}
}
int main()
{
fast();
solve(); return 0;
int t; in >> t;
while (t--) {
solve();
}
}
컴파일 시 표준 에러 (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... |