#include <iostream>
using namespace std;
long long n, a[200010], test, x, b[200010], j, c[200010];
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
j = 0;
while (a[i]%(1LL<<j) == 0) j++;
b[i] = b[i-1]+(1LL<<(j-1));
c[i] = (1LL<<(j-1));
}
j = 1;
cin >> test;
while (test--) {
cin >> x;
while (b[j] < x) j++;
cout << a[j]/c[j] << endl;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
312 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
86 ms |
5436 KB |
Output is correct |
4 |
Correct |
229 ms |
2800 KB |
Output is correct |
5 |
Correct |
365 ms |
7076 KB |
Output is correct |
6 |
Correct |
183 ms |
5368 KB |
Output is correct |
7 |
Correct |
352 ms |
7020 KB |
Output is correct |
8 |
Correct |
341 ms |
7240 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
312 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
312 KB |
Output is correct |
5 |
Correct |
1 ms |
308 KB |
Output is correct |
6 |
Correct |
1 ms |
312 KB |
Output is correct |
7 |
Correct |
1 ms |
308 KB |
Output is correct |
8 |
Correct |
3 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
304 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
3 ms |
340 KB |
Output is correct |
12 |
Correct |
3 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
3 ms |
320 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
312 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
86 ms |
5436 KB |
Output is correct |
4 |
Correct |
229 ms |
2800 KB |
Output is correct |
5 |
Correct |
365 ms |
7076 KB |
Output is correct |
6 |
Correct |
183 ms |
5368 KB |
Output is correct |
7 |
Correct |
352 ms |
7020 KB |
Output is correct |
8 |
Correct |
341 ms |
7240 KB |
Output is correct |
9 |
Correct |
1 ms |
312 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
312 KB |
Output is correct |
13 |
Correct |
1 ms |
308 KB |
Output is correct |
14 |
Correct |
1 ms |
312 KB |
Output is correct |
15 |
Correct |
1 ms |
308 KB |
Output is correct |
16 |
Correct |
3 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
304 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
3 ms |
340 KB |
Output is correct |
20 |
Correct |
3 ms |
340 KB |
Output is correct |
21 |
Correct |
1 ms |
340 KB |
Output is correct |
22 |
Correct |
3 ms |
320 KB |
Output is correct |
23 |
Correct |
196 ms |
3292 KB |
Output is correct |
24 |
Correct |
225 ms |
6348 KB |
Output is correct |
25 |
Correct |
388 ms |
10232 KB |
Output is correct |
26 |
Correct |
255 ms |
6456 KB |
Output is correct |
27 |
Correct |
216 ms |
6696 KB |
Output is correct |
28 |
Correct |
456 ms |
10688 KB |
Output is correct |
29 |
Correct |
516 ms |
10160 KB |
Output is correct |
30 |
Correct |
285 ms |
3932 KB |
Output is correct |
31 |
Correct |
474 ms |
10852 KB |
Output is correct |