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 pb push_back
#define mp make_pair
#define f1 first
#define s2 second
#define fastio ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define debug(x) cerr << "[" << #x << "]: " << x << "\n";
using ll = long long;
using ld = long double;
using ii = pair<int, int>;
using pl = pair<ll, ll>;
constexpr ld PI = 4*atan((ld)1);
int main()
{
fastio;
int n;
cin >> n;
vector<pl> v;
for (int i = 0; i < n; ++i)
{
ll x; cin >> x;
ll ctr = 1;
while (x % 2 == 0)
x /= 2, ctr *= 2;
v.pb({ctr, x});
}
for (int i = 1; i < n; ++i)
v[i].f1 += v[i-1].f1;
for (auto &[x, y] : v)
cerr << x << " " << y << '\n';
int q;
cin >> q;
while (q--)
{
ll x; cin >> x;
auto it = lower_bound(v.begin(), v.end(), mp(x, 0ll));
cout << it -> s2 << '\n';
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |