# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
800248 | caganyanmaz | Intercastellar (JOI22_ho_t1) | C++17 | 422 ms | 10700 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define int int64_t
using namespace std;
constexpr static int MXSIZE = 2e5;
int v[MXSIZE], prefix[MXSIZE+1], f[MXSIZE];
int32_t main()
{
int n;
cin >> n;
for (int i = 0; i < n; i++)
cin >> v[i];
for (int i = 0; i < n; i++)
{
f[i] = v[i];
int c = 1;
while (!(f[i]&1))
{
c <<= 1;
f[i] >>= 1;
}
prefix[i+1] = c;
}
for (int i = 1; i <= n; i++)
prefix[i] += prefix[i-1];
int q;
cin >> q;
while (q--)
{
int qq;
cin >> qq;
int l = 0, r = n+1;
while (r - l > 1)
{
int m = l+r>>1;
if (prefix[m] >= qq)
r = m;
else
l = m;
}
cout << f[l] << "\n";
}
}
컴파일 시 표준 에러 (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... |