Submission #1263764

#TimeUsernameProblemLanguageResultExecution timeMemory
1263764goulthenIntercastellar (JOI22_ho_t1)C++20
100 / 100
41 ms5444 KiB
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define rep(i,a,b) for (int i = a; i <= b; ++i)

const int MAXN = 2e5+10;
int a[MAXN],b[MAXN];

int32_t main() {
	ios_base::sync_with_stdio(0); cin.tie(nullptr);

	int n;cin >> n;
	rep(i,1,n) cin >> a[i];
	rep(i,1,n) {
		b[i] = a[i];
		while (b[i]%2==0) b[i] /= 2;
	}
	int q, j = 1, x = 0;cin >> q;
	while (q--) {
		int v;cin >> v;
		while (j < n && x + a[j]/b[j] < v) {
			x+=a[j]/b[j];
			j++;
		}


		cout << b[j] << '\n';
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...