#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
int n; cin >> n;
int a[n + 1], b[n + 1], c[n + 1], j;
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;
int q, x; cin >> q;
while (q--) {
cin >> x;
while (b[j] < x) j++;
cout << a[j]/c[j] << endl;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
216 KB |
Output is correct |
3 |
Correct |
78 ms |
5440 KB |
Output is correct |
4 |
Correct |
218 ms |
2828 KB |
Output is correct |
5 |
Correct |
294 ms |
7068 KB |
Output is correct |
6 |
Correct |
180 ms |
5356 KB |
Output is correct |
7 |
Correct |
301 ms |
7024 KB |
Output is correct |
8 |
Correct |
302 ms |
7088 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
300 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
300 KB |
Output is correct |
8 |
Correct |
2 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
2 ms |
340 KB |
Output is correct |
12 |
Correct |
3 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
312 KB |
Output is correct |
14 |
Correct |
3 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
216 KB |
Output is correct |
3 |
Correct |
78 ms |
5440 KB |
Output is correct |
4 |
Correct |
218 ms |
2828 KB |
Output is correct |
5 |
Correct |
294 ms |
7068 KB |
Output is correct |
6 |
Correct |
180 ms |
5356 KB |
Output is correct |
7 |
Correct |
301 ms |
7024 KB |
Output is correct |
8 |
Correct |
302 ms |
7088 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
300 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
300 KB |
Output is correct |
16 |
Correct |
2 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
2 ms |
340 KB |
Output is correct |
20 |
Correct |
3 ms |
340 KB |
Output is correct |
21 |
Correct |
1 ms |
312 KB |
Output is correct |
22 |
Correct |
3 ms |
340 KB |
Output is correct |
23 |
Correct |
189 ms |
3168 KB |
Output is correct |
24 |
Correct |
178 ms |
6196 KB |
Output is correct |
25 |
Correct |
383 ms |
10296 KB |
Output is correct |
26 |
Correct |
217 ms |
6504 KB |
Output is correct |
27 |
Correct |
189 ms |
6576 KB |
Output is correct |
28 |
Correct |
384 ms |
10712 KB |
Output is correct |
29 |
Correct |
478 ms |
10224 KB |
Output is correct |
30 |
Correct |
280 ms |
3820 KB |
Output is correct |
31 |
Correct |
392 ms |
10636 KB |
Output is correct |