#include<bits/stdc++.h>
using namespace std;
long long int T,Count;
vector<long long int> place;
vector<long long int> prefix;
int main(){
cin>>T;
for(int i=1;i<=T;i++){
long long int tmp;
cin>>tmp;
Count = 1;
while(!(tmp%2)){
tmp/=2;
Count*=2;
}
place.push_back(tmp);
if(prefix.empty()) prefix.push_back(Count);
else prefix.push_back(prefix.back()+Count);
}
int Q;
cin>>Q;
long long int Find;
for(int i=1;i<=Q;i++){
cin>>Find;
int place_answer = lower_bound(prefix.begin(),prefix.end(),Find)-prefix.begin();
cout<<place[place_answer]<<"\n";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
95 ms |
3568 KB |
Output is correct |
4 |
Correct |
247 ms |
1520 KB |
Output is correct |
5 |
Correct |
347 ms |
3932 KB |
Output is correct |
6 |
Correct |
172 ms |
3508 KB |
Output is correct |
7 |
Correct |
334 ms |
3996 KB |
Output is correct |
8 |
Correct |
362 ms |
3996 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
2 ms |
332 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
4 ms |
340 KB |
Output is correct |
12 |
Correct |
2 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
3 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
95 ms |
3568 KB |
Output is correct |
4 |
Correct |
247 ms |
1520 KB |
Output is correct |
5 |
Correct |
347 ms |
3932 KB |
Output is correct |
6 |
Correct |
172 ms |
3508 KB |
Output is correct |
7 |
Correct |
334 ms |
3996 KB |
Output is correct |
8 |
Correct |
362 ms |
3996 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
2 ms |
332 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
4 ms |
340 KB |
Output is correct |
20 |
Correct |
2 ms |
340 KB |
Output is correct |
21 |
Correct |
1 ms |
212 KB |
Output is correct |
22 |
Correct |
3 ms |
256 KB |
Output is correct |
23 |
Correct |
222 ms |
3320 KB |
Output is correct |
24 |
Correct |
179 ms |
5344 KB |
Output is correct |
25 |
Correct |
412 ms |
9136 KB |
Output is correct |
26 |
Correct |
243 ms |
5748 KB |
Output is correct |
27 |
Correct |
207 ms |
5736 KB |
Output is correct |
28 |
Correct |
490 ms |
9448 KB |
Output is correct |
29 |
Correct |
434 ms |
8940 KB |
Output is correct |
30 |
Correct |
300 ms |
3880 KB |
Output is correct |
31 |
Correct |
435 ms |
9312 KB |
Output is correct |