#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include<bits/extc++.h>
//__gnu_pbds
int main(){
ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
int n;cin>>n;
vector<pair<ll,ll>> arr(n+1);
for(int i=1;i<=n;i++){
int a;cin>>a;
ll cnt =1;
while(a%2==0){
a/=2;
cnt*=2;
}
arr[i] = {a,cnt};
}
for(int i=1;i<=n;i++){
arr[i].second+=arr[i-1].second;
}
int q;cin>>q;
int head = 0;
while(q--){
ll x;cin>>x;
while(arr[head].second<x) head++;
cout<<arr[head].first<<"\n";
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
27 ms |
3956 KB |
Output is correct |
4 |
Correct |
29 ms |
2252 KB |
Output is correct |
5 |
Correct |
45 ms |
5536 KB |
Output is correct |
6 |
Correct |
27 ms |
4048 KB |
Output is correct |
7 |
Correct |
53 ms |
5536 KB |
Output is correct |
8 |
Correct |
48 ms |
5536 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
324 KB |
Output is correct |
5 |
Correct |
1 ms |
320 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
296 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
356 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 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
27 ms |
3956 KB |
Output is correct |
4 |
Correct |
29 ms |
2252 KB |
Output is correct |
5 |
Correct |
45 ms |
5536 KB |
Output is correct |
6 |
Correct |
27 ms |
4048 KB |
Output is correct |
7 |
Correct |
53 ms |
5536 KB |
Output is correct |
8 |
Correct |
48 ms |
5536 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
324 KB |
Output is correct |
13 |
Correct |
1 ms |
320 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
296 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
356 KB |
Output is correct |
20 |
Correct |
1 ms |
340 KB |
Output is correct |
21 |
Correct |
1 ms |
340 KB |
Output is correct |
22 |
Correct |
1 ms |
340 KB |
Output is correct |
23 |
Correct |
26 ms |
2988 KB |
Output is correct |
24 |
Correct |
32 ms |
5196 KB |
Output is correct |
25 |
Correct |
61 ms |
8816 KB |
Output is correct |
26 |
Correct |
42 ms |
5636 KB |
Output is correct |
27 |
Correct |
41 ms |
5564 KB |
Output is correct |
28 |
Correct |
77 ms |
9164 KB |
Output is correct |
29 |
Correct |
86 ms |
8712 KB |
Output is correct |
30 |
Correct |
36 ms |
3664 KB |
Output is correct |
31 |
Correct |
80 ms |
9164 KB |
Output is correct |