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>
#define int long long
#define pii pair<int, int>
using namespace std;
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<int>v(n);
for (auto &i : v) cin >> i;
vector<pii>p(n);
for (int i = 0 ; i < n ; i++) {
int num = 1;
while (v[i] % 2 == 0) {
v[i] /= 2;
num *= 2;
}
if (i == 0) p[i] = {num, v[i]};
else p[i] = {num + p[i-1].first, v[i]};
cout << p[i].first << " " << p[i].second << "\n";
}
int q, x, l = 0;
cin >> q;
while (q--) {
cin >> x;
while (x > p[l].first) l++;
cout << p[l].second << "\n";
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |