이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
long long tab[200005];
long long dwa[40];
void D(){
	dwa[0] = 1;
	for(int i = 1; i <= 31; i++) dwa[i] = dwa[i-1]*2;
}
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	D();
	
	int n;
	cin >> n;
	for(int i = 0; i < n; i++) cin >> tab[i];
	int q;
	cin >> q;
	long long l = 0;
	int ind = 0;
	while(q--){
		long long x;
		long long occ, val;
		cin >> x;
		if(x <= l){
			cout << val <<'\n';
			continue;
		}
		//cerr << ind << " " << tab[ind] << " " << l << " " << x<< ":"<<'\n';
		while(l < x){
			//cerr << occ << " " << val << " " << l << '\n';
			occ = 1, val = tab[ind];
			for(int i = 30; i >= 0; i--){
				if(val % dwa[i] == 0){
					//cerr << i << '\n';
					occ *= dwa[i];
					val /= dwa[i];
				}
			}
			ind++;
			l += occ;
		}
		cout << val << '\n';
	}
			
		
	
	
	return 0;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |