제출 #1174722

#제출 시각아이디문제언어결과실행 시간메모리
1174722TsaganaIntercastellar (JOI22_ho_t1)C++20
100 / 100
188 ms5444 KiB
#include<bits/stdc++.h>

#define IOS ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define all(x) x.begin(), x.end()
#define int long long
#define pq priority_queue
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pp pop_back
#define F first
#define S second

using namespace std;

void solve () {
	int n;
	cin >> n;

	vector<int> a(n+1);
	vector<int> l(n+1);

	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		int x = 1;
		while (a[i] % 2 == 0) {a[i] /= 2; x *= 2;}
		l[i] = l[i-1] + x;
	}

	int q;
	cin >> q;
	for (int i = 1; q; q--) {
		int x;
		cin >> x;
		while (l[i] < x) i++;
		cout << a[i] << '\n';
	}
}
signed main() {IOS solve(); return 0;}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...