제출 #585781

#제출 시각아이디문제언어결과실행 시간메모리
585781Drew_Intercastellar (JOI22_ho_t1)C++17
100 / 100
1016 ms13264 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...