Submission #1323377

#TimeUsernameProblemLanguageResultExecution timeMemory
1323377khanhphucscratchIntercastellar (JOI22_ho_t1)C++20
100 / 100
49 ms5304 KiB
#include<bits/stdc++.h>
#define int long long
using namespace std;
int a[200005], b[200005];
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n; cin>>n;
    for(int i = 1; i <= n; i++){
        cin>>a[i]; b[i] = 1;
        while(a[i]%2 == 0){
            a[i] >>= 1; b[i] <<= 1;
        }
        b[i] += b[i-1];
    }
    int q; cin>>q;
    for(int test = 0; test < q; test++){
        int x; cin>>x;
        int p = lower_bound(b+1, b+n+1, x) - b;
        cout<<a[p]<<'\n';
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...