#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define st first
#define nd second
typedef long long ll;
typedef long double ld;
const ll I = 1000'000'000'000'000'000LL;
const int II = 2'000'000'000;
const ll M = 1000'000'007LL;
const int N = 1000'007;
int tab[N];
ll il[N];
void Solve()
{
int n, q;
cin >> n;
for(int i = 1; i <= n; ++i)
{
cin >> tab[i];
il[i] = 1;
while(tab[i] % 2 == 0)
{tab[i] /= 2; il[i] *= 2;}
il[i] += il[i - 1];
//cout << tab[i] << " " << il[i] << "\n";
}
int j = 1; ll a;
cin >> q;
for(int i = 1; i <= q; ++i)
{
cin >> a;
while(il[j] < a && j < n) ++j;
cout << tab[j] << "\n";
}
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
//int t; cin >> t;
//while(t--)
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... |