제출 #1307572

#제출 시각아이디문제언어결과실행 시간메모리
1307572samarthkulkarniIntercastellar (JOI22_ho_t1)C++20
25 / 100
711 ms589824 KiB
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
#define vi vector<long long>
#define all(x) x.begin(), x.end()
#define endl "\n"

void solution();
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    solution();
    return 0;
}

vi a;

void solution() {
	int n; cin >> n;

	for (int i = 0; i < n; i++) {
		ll x; cin >> x;
		ll temp = x;
		while (x&1^1) {
			x/=2;
		}

		for (int j = 0; j < temp/x; j++) a.push_back(x);
	}

	int q; cin >> q;
	while (q--) {
		int x; cin >> x; x--;
		cout << a[x] << endl;
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...