#include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
vector<long long>v;
for(int i = 0;i < n;++i){
long long a, tmp;
cin >> a;
tmp = a;
while(tmp % 2 == 0){
tmp /= 2;
}
int num = a / tmp;
for(int j = 0;j < num;++j)v.push_back(tmp);
}
int q;
cin >> q;
while(q--){
int pos;
cin >> pos;
pos--;
cout << v[pos] << '\n';
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
18 ms |
4940 KB |
Output is correct |
4 |
Correct |
25 ms |
2648 KB |
Output is correct |
5 |
Correct |
40 ms |
6464 KB |
Output is correct |
6 |
Correct |
29 ms |
9284 KB |
Output is correct |
7 |
Correct |
45 ms |
9136 KB |
Output is correct |
8 |
Correct |
50 ms |
17292 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Runtime error |
416 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
18 ms |
4940 KB |
Output is correct |
4 |
Correct |
25 ms |
2648 KB |
Output is correct |
5 |
Correct |
40 ms |
6464 KB |
Output is correct |
6 |
Correct |
29 ms |
9284 KB |
Output is correct |
7 |
Correct |
45 ms |
9136 KB |
Output is correct |
8 |
Correct |
50 ms |
17292 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 |
416 ms |
524288 KB |
Execution killed with signal 9 |
12 |
Halted |
0 ms |
0 KB |
- |