#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll n, q, x, idx, a[200010], ans[200010];
ll div2(ll pc) {
int i;
for(i=1; pc%2 == 0; i++) {
pc /= 2;
}
return pow(2, i-1);
}
int main() {
cin.tie(0)->sync_with_stdio(0);
cin >> n;
for(int i=1; i<=n; i++) {
cin >> a[i];
ans[i] = div2(a[i]);
ans[i] += ans[i-1];
}
cin >> q;
while(q--) {
cin >> x;
idx = lower_bound(ans+1, ans+n+1, x) - ans;
cout << a[idx]/(ans[idx]-ans[idx-1]) << "\n";
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Correct |
2 ms |
2396 KB |
Output is correct |
3 |
Correct |
20 ms |
4120 KB |
Output is correct |
4 |
Correct |
26 ms |
3928 KB |
Output is correct |
5 |
Correct |
45 ms |
5456 KB |
Output is correct |
6 |
Correct |
27 ms |
4444 KB |
Output is correct |
7 |
Correct |
46 ms |
5680 KB |
Output is correct |
8 |
Correct |
44 ms |
5716 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
6 |
Correct |
1 ms |
2396 KB |
Output is correct |
7 |
Correct |
1 ms |
2392 KB |
Output is correct |
8 |
Correct |
1 ms |
2564 KB |
Output is correct |
9 |
Correct |
1 ms |
2652 KB |
Output is correct |
10 |
Correct |
1 ms |
2396 KB |
Output is correct |
11 |
Correct |
1 ms |
2532 KB |
Output is correct |
12 |
Correct |
1 ms |
2396 KB |
Output is correct |
13 |
Correct |
1 ms |
2396 KB |
Output is correct |
14 |
Correct |
1 ms |
2396 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Correct |
2 ms |
2396 KB |
Output is correct |
3 |
Correct |
20 ms |
4120 KB |
Output is correct |
4 |
Correct |
26 ms |
3928 KB |
Output is correct |
5 |
Correct |
45 ms |
5456 KB |
Output is correct |
6 |
Correct |
27 ms |
4444 KB |
Output is correct |
7 |
Correct |
46 ms |
5680 KB |
Output is correct |
8 |
Correct |
44 ms |
5716 KB |
Output is correct |
9 |
Correct |
1 ms |
2396 KB |
Output is correct |
10 |
Correct |
1 ms |
2396 KB |
Output is correct |
11 |
Correct |
1 ms |
2396 KB |
Output is correct |
12 |
Correct |
1 ms |
2396 KB |
Output is correct |
13 |
Correct |
1 ms |
2396 KB |
Output is correct |
14 |
Correct |
1 ms |
2396 KB |
Output is correct |
15 |
Correct |
1 ms |
2392 KB |
Output is correct |
16 |
Correct |
1 ms |
2564 KB |
Output is correct |
17 |
Correct |
1 ms |
2652 KB |
Output is correct |
18 |
Correct |
1 ms |
2396 KB |
Output is correct |
19 |
Correct |
1 ms |
2532 KB |
Output is correct |
20 |
Correct |
1 ms |
2396 KB |
Output is correct |
21 |
Correct |
1 ms |
2396 KB |
Output is correct |
22 |
Correct |
1 ms |
2396 KB |
Output is correct |
23 |
Correct |
29 ms |
4864 KB |
Output is correct |
24 |
Correct |
30 ms |
5596 KB |
Output is correct |
25 |
Correct |
57 ms |
8784 KB |
Output is correct |
26 |
Correct |
38 ms |
6224 KB |
Output is correct |
27 |
Correct |
37 ms |
6108 KB |
Output is correct |
28 |
Correct |
65 ms |
9300 KB |
Output is correct |
29 |
Correct |
66 ms |
8816 KB |
Output is correct |
30 |
Correct |
32 ms |
5460 KB |
Output is correct |
31 |
Correct |
66 ms |
9296 KB |
Output is correct |