이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/**
____ ____ ____ ____ ____ ____
||l |||e |||i |||n |||a |||d ||
||__|||__|||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|/__\|/__\|
**/
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long ll;
void speed()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
const int maxn = 2e5 + 10;
int n, q;
ll a[maxn], pref[maxn];
void solve()
{
cin >> n;
for (int i = 1; i <= n; i ++)
{
cin >> a[i];
ll bit = 0;
while(a[i] % ((ll)1 << bit) == 0)
bit ++;
bit --;
pref[i] = pref[i - 1] + ((ll)1 << bit);
a[i] /= ((ll)1 << bit);
}
cin >> q;
for (int i = 1; i <= q; i ++)
{
int l = 0, r = n;
ll x;
cin >> x;
while(l <= r)
{
int m = (l + r) / 2;
if (pref[m] < x)
l = m + 1;
else
r = m - 1;
}
cout << a[l] << endl;
}
}
int main()
{
speed();
solve();
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |