Submission #1282945

#TimeUsernameProblemLanguageResultExecution timeMemory
1282945dhuyyyyIntercastellar (JOI22_ho_t1)C++20
100 / 100
66 ms5488 KiB
 #include<bits/stdc++.h>
#define fi first
#define se second
#define int long long
using namespace std;

using ll = long long;
using ii = pair<int, int>;
using aa = array<int,4>;

const int N = 2e5+5;
const ll INF = 1e18;
const int MOD = 1e9+7;
const int base = 31;

int n, q, x;

int pre[N], a[N];

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cin >> n;
    for (int i = 1; i <= n; i++){
        cin >> a[i];
        pre[i] = 1;
        while (a[i] % 2 == 0){
            pre[i] *= 2;
            a[i] /= 2;
        }
        pre[i] += pre[i-1];
    }
    cin >> q;
    while (q--){
        cin >> x;
        x = lower_bound(pre+1,pre+1+n,x) - pre;
        cout << a[x] << '\n';
    }
    return 0;
}


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