제출 #1216306

#제출 시각아이디문제언어결과실행 시간메모리
1216306trimkusIntercastellar (JOI22_ho_t1)C++20
100 / 100
40 ms3908 KiB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;




int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	vector<ll> a(n);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	ll p = 0, len = 0;
	int ptr = 0;
	int q;
	cin >> q;
	while (q--) {
		ll x;
		cin >> x;
		while (p < x) {
			ll cnt = 1;
			while (a[ptr] % 2 == 0) {
				cnt *= 2;
				a[ptr] /= 2;
			}
			len = a[ptr];
			p += cnt;
			ptr += 1;
		}
		cout << len << "\n";
	}
	
}

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