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 Loop(x,l,r) for (ll x = (l); x < (ll)(r); ++x)
#define LoopR(x,l,r) for (ll x = (r)-1; x >= (ll)(l); --x)
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll , ll > pll;
using namespace std;
int main()
{
cin.tie(0) -> sync_with_stdio(false);
int n;
cin >> n;
vector<ll> a(n), b(n+1);
Loop (i,0,n)
cin >> a[i];
Loop (i,0,n)
b[i+1] = b[i] + (a[i] & -a[i]);
int q;
cin >> q;
while (q--) {
ll x;
cin >> x;
int i = lower_bound(b.begin(), b.end(), x) - b.begin() - 1;
cout << a[i] / (a[i] & -a[i]) << '\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... |