제출 #1286634

#제출 시각아이디문제언어결과실행 시간메모리
1286634kaiboyIntercastellar (JOI22_ho_t1)C++20
100 / 100
46 ms4560 KiB
#include <algorithm>
#include <iostream>

using namespace std;

const int N = 200000;

int aa[N], kk[N];

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	int n; cin >> n;
	for (int i = 0; i < n; i++) {
		int a; cin >> a;
		int k = 1;
		while (a % 2 == 0)
			a /= 2, k *= 2;
		aa[i] = a, kk[i] = k;
	}
	int q; cin >> q;
	long long s = 0;
	for (int i = -1; q--; ) {
		long long t; cin >> t;
		while (s < t)
			s += kk[++i];
		cout << aa[i] << '\n';
	}
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...