#include <bits/stdc++.h>
using namespace std;
#define int long long
#define OYY 1000000005
#define mod 998244353
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mid (start+end)/2
#define lim 200005
#define se second
#define fi first
int dizi[lim];
int32_t main(){
faster
int n;cin>>n;
vector<int> cev(n,0);
for(int i=0;i<n;i++){
cin>>dizi[i];
while((dizi[i]%2)==0){
cev[i]++;
dizi[i]/=2;
}
cev[i]=(1<<cev[i]);
if(i!=0)cev[i]+=cev[i-1];
}
//for(int i=0;i<n;i++)cout<<cev[i]<<" ";
int q;cin>>q;
while(q--){
int x;cin>>x;
int deg=lower_bound(cev.begin(),cev.end(),x)-cev.begin();
cout<<dizi[deg]<<'\n';
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
16 ms |
4124 KB |
Output is correct |
4 |
Correct |
24 ms |
2396 KB |
Output is correct |
5 |
Correct |
41 ms |
5592 KB |
Output is correct |
6 |
Correct |
23 ms |
4188 KB |
Output is correct |
7 |
Correct |
45 ms |
5460 KB |
Output is correct |
8 |
Correct |
43 ms |
5716 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
468 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 |
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 |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
2 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
16 ms |
4124 KB |
Output is correct |
4 |
Correct |
24 ms |
2396 KB |
Output is correct |
5 |
Correct |
41 ms |
5592 KB |
Output is correct |
6 |
Correct |
23 ms |
4188 KB |
Output is correct |
7 |
Correct |
45 ms |
5460 KB |
Output is correct |
8 |
Correct |
43 ms |
5716 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
468 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 |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
2 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
22 ms |
3172 KB |
Output is correct |
24 |
Correct |
27 ms |
5200 KB |
Output is correct |
25 |
Correct |
52 ms |
8784 KB |
Output is correct |
26 |
Correct |
36 ms |
5660 KB |
Output is correct |
27 |
Correct |
33 ms |
5724 KB |
Output is correct |
28 |
Correct |
60 ms |
9180 KB |
Output is correct |
29 |
Correct |
59 ms |
8784 KB |
Output is correct |
30 |
Correct |
31 ms |
3780 KB |
Output is correct |
31 |
Correct |
60 ms |
9296 KB |
Output is correct |