#include<bits/stdc++.h>
using namespace std;
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;
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 |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
105 ms |
4168 KB |
Output is correct |
4 |
Correct |
253 ms |
2560 KB |
Output is correct |
5 |
Correct |
337 ms |
5692 KB |
Output is correct |
6 |
Correct |
173 ms |
4220 KB |
Output is correct |
7 |
Correct |
367 ms |
5772 KB |
Output is correct |
8 |
Correct |
339 ms |
5796 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 |
1 ms |
292 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 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 |
340 KB |
Output is correct |
9 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
105 ms |
4168 KB |
Output is correct |
4 |
Correct |
253 ms |
2560 KB |
Output is correct |
5 |
Correct |
337 ms |
5692 KB |
Output is correct |
6 |
Correct |
173 ms |
4220 KB |
Output is correct |
7 |
Correct |
367 ms |
5772 KB |
Output is correct |
8 |
Correct |
339 ms |
5796 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
292 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
1 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 |
340 KB |
Output is correct |
17 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
18 |
Halted |
0 ms |
0 KB |
- |