#include<bits/stdc++.h>
using namespace std;
#define int long long
int n;int Q;
vector<int>ar;
signed main(){
cin>>n;
for(int i=1;i<=n;i++){
int v;
cin>>v;
int cnt=1;
while(v%2==0){
cnt++;v/=2;
}
for(int j=0;j<(1<<(cnt-1));j++){
ar.push_back(v);
}
}
/*
for(int i=0;i<ar.size();i++){
cout<<ar[i]<<" ";
}
*/
cin>>Q;
while(Q--){
int xi;
cin>>xi;
cout<<ar[xi-1]<<endl;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
97 ms |
4548 KB |
Output is correct |
4 |
Correct |
236 ms |
2712 KB |
Output is correct |
5 |
Correct |
322 ms |
6428 KB |
Output is correct |
6 |
Correct |
169 ms |
9044 KB |
Output is correct |
7 |
Correct |
328 ms |
9028 KB |
Output is correct |
8 |
Correct |
353 ms |
17224 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 |
Runtime error |
395 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
97 ms |
4548 KB |
Output is correct |
4 |
Correct |
236 ms |
2712 KB |
Output is correct |
5 |
Correct |
322 ms |
6428 KB |
Output is correct |
6 |
Correct |
169 ms |
9044 KB |
Output is correct |
7 |
Correct |
328 ms |
9028 KB |
Output is correct |
8 |
Correct |
353 ms |
17224 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Runtime error |
395 ms |
524288 KB |
Execution killed with signal 9 |
12 |
Halted |
0 ms |
0 KB |
- |