Submission #1258591

#TimeUsernameProblemLanguageResultExecution timeMemory
1258591namhhIntercastellar (JOI22_ho_t1)C++20
35 / 100
4 ms1860 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pii pair<int,int>
#define fi first
#define se second
const int N = 1e5+5;
int n,q,a[N],sl[N],pre[N];
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> a[i];
		sl[i] = 1;
		while(a[i] % 2 == 0){
			a[i] /= 2;
			sl[i] *= 2;
		}
	}
	for(int i = 1; i <= n; i++) pre[i] = pre[i-1]+sl[i];
	cin >> q;
	while(q--){
		int x;
		cin >> x;
		int cc = lower_bound(pre+1,pre+n+1,x)-pre;
		cout << a[cc] << "\n";
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...