#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n, q;
int a[200002];
int val[200002];
int cnt[200002];
int main(){
ios_base::sync_with_stdio(false), cin.tie(nullptr);
cin >> n;
for(int i=1; i<=n; i++){
cin >> a[i];
int tmp = a[i];
while(tmp%2==0){
tmp /= 2;
}
val[i] = tmp;
cnt[i] = a[i]/tmp + cnt[i-1];
}
cin >> q;
while(q--){
int x;
cin >> x;
int h = lower_bound(cnt+1, cnt+n+1, x) - cnt;
cout << val[h]<< '\n';
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
21 ms |
3224 KB |
Output is correct |
4 |
Correct |
38 ms |
2116 KB |
Output is correct |
5 |
Correct |
54 ms |
4688 KB |
Output is correct |
6 |
Correct |
31 ms |
3404 KB |
Output is correct |
7 |
Correct |
53 ms |
4720 KB |
Output is correct |
8 |
Correct |
50 ms |
4836 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 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 |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
21 ms |
3224 KB |
Output is correct |
4 |
Correct |
38 ms |
2116 KB |
Output is correct |
5 |
Correct |
54 ms |
4688 KB |
Output is correct |
6 |
Correct |
31 ms |
3404 KB |
Output is correct |
7 |
Correct |
53 ms |
4720 KB |
Output is correct |
8 |
Correct |
50 ms |
4836 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
18 |
Halted |
0 ms |
0 KB |
- |