# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
800248 | caganyanmaz | Intercastellar (JOI22_ho_t1) | C++17 | 422 ms | 10700 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.
#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";
}
}
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... |