이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5;
int a[MAXN];
int main() {
    ios_base::sync_with_stdio(false);
	cin.tie(0);
    int n, q, i, pnt;
    long long p2 = 0, x;
    cin >> n;
    for(i = 0; i < n; i++){
        cin >> a[i];
    }
    cin >> q;
    pnt = -1; // We start from -1, since we want our first pnt to be 0 (x + 1 = 0 => x = 0 - 1 => x = -1)
    for(i = 0; i < q; i++){
        cin >> x;
        while(p2 < x){
            ++pnt; // Update our pointer
            long long put2 = 1;
            while(a[pnt] % 2 == 0){ // While our number is still divisible with 2
                a[pnt] /= 2; // Divide
                put2 *= 2; // and update our power
            }
            // This means that now put2 * a[pnt] = original a[pnt]
            p2 += put2; // And we just add this value to our total one
        }
        cout << a[pnt] << "\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... |