#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0); cin.tie(0);
int n, q;
cin >> n;
int a[n];
for(int i=0; i<n; i++) cin >> a[i];
vector<int> v;
for(int i=0; i<n; i++) {
int x = a[i], count = 0;
while(x%2==0) {
x/=2;
count++;
}
for(int j=0; j<(1<<count); j++) {
v.push_back(x);
}
}
cin >> q;
while(q--) {
int x;
cin >> x;
cout << v[x-1] << '\n';
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
21 ms |
3240 KB |
Output is correct |
4 |
Correct |
28 ms |
1356 KB |
Output is correct |
5 |
Correct |
45 ms |
3520 KB |
Output is correct |
6 |
Correct |
31 ms |
5148 KB |
Output is correct |
7 |
Correct |
55 ms |
5324 KB |
Output is correct |
8 |
Correct |
66 ms |
9400 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 |
567 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 |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
21 ms |
3240 KB |
Output is correct |
4 |
Correct |
28 ms |
1356 KB |
Output is correct |
5 |
Correct |
45 ms |
3520 KB |
Output is correct |
6 |
Correct |
31 ms |
5148 KB |
Output is correct |
7 |
Correct |
55 ms |
5324 KB |
Output is correct |
8 |
Correct |
66 ms |
9400 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 |
567 ms |
524288 KB |
Execution killed with signal 9 |
12 |
Halted |
0 ms |
0 KB |
- |