Submission #1098588

#TimeUsernameProblemLanguageResultExecution timeMemory
1098588vako_pIntercastellar (JOI22_ho_t1)C++14
100 / 100
54 ms9300 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back

const int mxN = 2e5 + 5;
ll n,a[mxN],q,val[mxN];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		val[i] = 1;
		while(a[i] % 2 == 0){
			val[i] *= 2;
			a[i] /= 2;
		}
	}
	cin >> q;
	ll l = 0,num = 0;
	while(q--){
		ll x;
		cin >> x;
		while(x - num > val[l]) num += val[l++];
		cout << a[l] << '\n';
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...