Submission #1168451

#TimeUsernameProblemLanguageResultExecution timeMemory
1168451lxz20071231Intercastellar (JOI22_ho_t1)C++20
100 / 100
35 ms6980 KiB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const int N = 200005;
ll sz[N], l[N], a[N];

int main () {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    
    int n, q;
    cin >> n;
    for (int i=1; i<=n; i++){
        cin >> a[i];
        sz[i] = a[i] & -a[i];
        l[i] = a[i] / sz[i];
    }

    ll passed = 0;
    int ind = 1;

    cin >> q;

    while (q--){
        ll x; cin >> x;
        while (passed + sz[ind] < x){
            passed += sz[ind];
            ind++;
        }
        cout << l[ind] << '\n';
    }
    
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...