#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
int main(){
ll n;
cin >> n;
vector <ll> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
vector <ll> prefsum(1,0);
for (int i = 0; i < n; i++){
ll stependv = 1;
while (a[i]%(stependv*2) == 0)
stependv *= 2;
a[i]/= stependv;
prefsum.push_back(prefsum[i] + stependv);
}
ll q;
cin >> q;
for (int i = 0; i < q; i++){
ll x;
cin >> x;
ll l = 0, r = n;
while (l < r){
ll mid = (l+r)/2;
if (prefsum[mid] < x)
l = mid + 1;
else
r = mid;
}
cout << a[l] << endl;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |