제출 #1237183

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

using namespace std;

const int N = 2e5 + 1;
int n, Q, a[N];

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

	cin >> n;
	for (int i = 1; i <= n; i++) cin >> a[i];
	long long cur = 0, val = 0;
	cin >> Q;
	for (int i = 1, j = 1; i <= Q; i++) {
		long long x;
		cin >> x;
		while (cur < x) {
			int t = 1;
			while (~a[j] & 1) t <<= 1, a[j] >>= 1;
			cur += t;
			val = a[j];
			j++;
		}
		cout << val << '\n';
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...