#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n; cin >> n;
vector<int> a(n);
for(auto &i: a) cin >> i;
vector<int> s(n);
for(int i=0; i<n; i++){
s[i] = a[i];
while(s[i] %2==0){
s[i]/=2;
}
}
int pos=0, e=0;
int q; cin >> q;
while(q--){
int x; cin >> x;
while(pos<n&&e+a[pos]/s[pos]<x){
e+=a[pos]/s[pos];
pos++;
}
cout<<s[pos]<<"\n";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
444 KB |
Output is correct |
3 |
Correct |
18 ms |
3932 KB |
Output is correct |
4 |
Correct |
23 ms |
2396 KB |
Output is correct |
5 |
Correct |
39 ms |
5460 KB |
Output is correct |
6 |
Correct |
22 ms |
4188 KB |
Output is correct |
7 |
Correct |
38 ms |
5500 KB |
Output is correct |
8 |
Correct |
41 ms |
5652 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 |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
344 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 |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
600 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
444 KB |
Output is correct |
3 |
Correct |
18 ms |
3932 KB |
Output is correct |
4 |
Correct |
23 ms |
2396 KB |
Output is correct |
5 |
Correct |
39 ms |
5460 KB |
Output is correct |
6 |
Correct |
22 ms |
4188 KB |
Output is correct |
7 |
Correct |
38 ms |
5500 KB |
Output is correct |
8 |
Correct |
41 ms |
5652 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
344 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 |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
600 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
21 ms |
3156 KB |
Output is correct |
24 |
Correct |
26 ms |
5372 KB |
Output is correct |
25 |
Correct |
50 ms |
8784 KB |
Output is correct |
26 |
Correct |
33 ms |
5720 KB |
Output is correct |
27 |
Correct |
34 ms |
5712 KB |
Output is correct |
28 |
Correct |
59 ms |
9300 KB |
Output is correct |
29 |
Correct |
56 ms |
8668 KB |
Output is correct |
30 |
Correct |
30 ms |
3716 KB |
Output is correct |
31 |
Correct |
58 ms |
9248 KB |
Output is correct |