#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int a[100100], p[100100];
ll qs[100100];
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int n;
cin >> n;
for (int i = 1;i <= n;i++) {
cin >> a[i];
p[i] = 1;
while (a[i] % 2 == 0) {
a[i] /= 2;
p[i] *= 2;
}
}
for (int i = 1;i <= n;i++) {
qs[i] = qs[i - 1] + p[i];
}
int q;
cin >> q;
while (q--) {
int x;
cin >> x;
cout << a[lower_bound(qs + 1, qs + 1 + n, x) - qs] << '\n';
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Runtime error |
8 ms |
2356 KB |
Execution killed with signal 11 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
508 KB |
Output is correct |
4 |
Correct |
1 ms |
408 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
476 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Runtime error |
8 ms |
2356 KB |
Execution killed with signal 11 |
4 |
Halted |
0 ms |
0 KB |
- |