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;
inline namespace
{
} // namespace
void solve(int _test_ = -1)
{
int n;
cin >> n;
vector<long> a(n);
for (long &x : a)
cin >> x;
vector<pair<long, long>> b(n);
for (int i = 0; i < n; i++)
{
long tz = __builtin_ctzl(a[i]);
b[i] = pair(a[i] >> tz, 1l << tz);
}
int q;
cin >> q;
int j = 0;
long c = 0;
for (int z = 0; z < q; z++)
{
long d;
cin >> d;
while (c + b[j].second < d)
{
c += b[j].second;
j++;
}
cout << b[j].first << '\n';
}
}
int main()
{
ios_base::sync_with_stdio(false), cin.tie(NULL);
int T_ = 1;
// cin >> T_;
for (int t_ = 0; t_ < T_; t_++)
solve(t_);
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... |