이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |