#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
//your code goes here
int n;
cin >> n;
vector <int> arr = {};
for(int i = 0; i < n; i++) {
int num;
cin >> num;
int val = 1;
// cout << num << " b " << endl;
while(num%2 == 0) {
val *= 2;
num /= 2;
}
// cout << num << " v " << endl;
for(int i = 1; i <= val; i++) {
arr.push_back(num);
}
}
int q;
cin >> q;
for(int i = 0; i < q; i++) {
int x;
cin >> x;
cout << arr[x-1] << endl;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
74 ms |
5676 KB |
Output is correct |
4 |
Correct |
213 ms |
2664 KB |
Output is correct |
5 |
Correct |
298 ms |
6476 KB |
Output is correct |
6 |
Correct |
155 ms |
11048 KB |
Output is correct |
7 |
Correct |
306 ms |
10952 KB |
Output is correct |
8 |
Correct |
311 ms |
18616 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Runtime error |
286 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
74 ms |
5676 KB |
Output is correct |
4 |
Correct |
213 ms |
2664 KB |
Output is correct |
5 |
Correct |
298 ms |
6476 KB |
Output is correct |
6 |
Correct |
155 ms |
11048 KB |
Output is correct |
7 |
Correct |
306 ms |
10952 KB |
Output is correct |
8 |
Correct |
311 ms |
18616 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Runtime error |
286 ms |
524288 KB |
Execution killed with signal 9 |
12 |
Halted |
0 ms |
0 KB |
- |