Submission #863811

#TimeUsernameProblemLanguageResultExecution timeMemory
863811phoenix0423Intercastellar (JOI22_ho_t1)C++17
100 / 100
62 ms7508 KiB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pll;
#define fastio ios::sync_with_stdio(false), cin.tie(0)
#pragma GCC optimize("Ofast")
#define pb push_back
#define eb emplace_back
#define f first
#define s second
#define lowbit(x) x&-x
const int maxn = 2e5 + 5;
const int INF = 1e9;

int main(void){
	fastio;
	int n;
	cin>>n;
	vector<ll> a(n), cnt(n);
	for(int i = 0; i < n; i++){
		cin>>a[i];
		cnt[i] = 1;
		while(a[i] % 2 == 0) a[i] /= 2, cnt[i] *= 2;
	}
	for(int i = 1; i < n; i++) cnt[i] += cnt[i - 1];
	int q;
	cin>>q;
	int cur = 0;
	for(int i = 0; i < q; i++){
		ll x;
		cin>>x;
		while(cnt[cur] < x) cur++;
		cout<<a[cur]<<"\n";
	}

}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...