#include<bits/stdc++.h>
typedef long long ll;
#define fastio cin.tie(0), cout.tie(0), ios::sync_with_stdio(0);
using namespace std;
int main(){
fastio
int n, q, pt = 0;
ll x;
cin >> n;
vector<int> a(n+1);
vector<ll> pre(n+1, 0);
for(int i=1; i<=n; i++){
cin >> a[i];
pre[i] = a[i]&-a[i];
a[i] >>= __lg(pre[i]);
pre[i] += pre[i-1];
}
for(cin >> q; q; q--){
cin >> x;
while(x>pre[pt]) pt++;
cout << a[pt] << '\n';
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
14 ms |
3420 KB |
Output is correct |
4 |
Correct |
23 ms |
2128 KB |
Output is correct |
5 |
Correct |
35 ms |
4728 KB |
Output is correct |
6 |
Correct |
21 ms |
3416 KB |
Output is correct |
7 |
Correct |
40 ms |
4904 KB |
Output is correct |
8 |
Correct |
36 ms |
4956 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
468 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
14 ms |
3420 KB |
Output is correct |
4 |
Correct |
23 ms |
2128 KB |
Output is correct |
5 |
Correct |
35 ms |
4728 KB |
Output is correct |
6 |
Correct |
21 ms |
3416 KB |
Output is correct |
7 |
Correct |
40 ms |
4904 KB |
Output is correct |
8 |
Correct |
36 ms |
4956 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
384 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
468 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
21 ms |
2908 KB |
Output is correct |
24 |
Correct |
25 ms |
4680 KB |
Output is correct |
25 |
Correct |
48 ms |
7960 KB |
Output is correct |
26 |
Correct |
30 ms |
5204 KB |
Output is correct |
27 |
Correct |
29 ms |
4932 KB |
Output is correct |
28 |
Correct |
51 ms |
8552 KB |
Output is correct |
29 |
Correct |
50 ms |
8016 KB |
Output is correct |
30 |
Correct |
29 ms |
3668 KB |
Output is correct |
31 |
Correct |
52 ms |
8372 KB |
Output is correct |