# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1032413 | nguyendinhanh1508 | Intercastellar (JOI22_ho_t1) | C++17 | 337 ms | 524288 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
if(x - 1 < vec.size()) cout << vec[x - 1] << '\n';
else cout << "-1\n";
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |