#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mx 1000007
#define inf LLONG_MAX/20
#define pi pair<int, int>
#define mp make_pair
int a[mx];
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin >> n;
for(int i = 0; i < n; i++){
cin >> a[i];
}
vector<int> vec;
for(int i = 0; i < n; i++){
int count = 1;
while(a[i] % 2 == 0){
a[i] /= 2;
count *= 2;
}
for(int j = 0; j < count; j++){
vec.push_back(a[i]);
}
}
int q;
cin >> q;
while(q--){
int x;
cin >> x;
cout << vec[x - 1] << '\n';
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
14 ms |
6612 KB |
Output is correct |
4 |
Correct |
17 ms |
3032 KB |
Output is correct |
5 |
Correct |
32 ms |
8144 KB |
Output is correct |
6 |
Correct |
21 ms |
10448 KB |
Output is correct |
7 |
Correct |
34 ms |
10960 KB |
Output is correct |
8 |
Correct |
37 ms |
19148 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Runtime error |
357 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
14 ms |
6612 KB |
Output is correct |
4 |
Correct |
17 ms |
3032 KB |
Output is correct |
5 |
Correct |
32 ms |
8144 KB |
Output is correct |
6 |
Correct |
21 ms |
10448 KB |
Output is correct |
7 |
Correct |
34 ms |
10960 KB |
Output is correct |
8 |
Correct |
37 ms |
19148 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Runtime error |
357 ms |
524288 KB |
Execution killed with signal 9 |
12 |
Halted |
0 ms |
0 KB |
- |