Submission #529403

#TimeUsernameProblemLanguageResultExecution timeMemory
529403wiwihoIntercastellar (JOI22_ho_t1)C++14
100 / 100
85 ms8924 KiB
#include <bits/stdc++.h> #define iter(a) a.begin(), a.end() using namespace std; typedef long long ll; int main(){ ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<ll> c(n + 1), v(n + 1); for(int i = 1; i <= n; i++){ ll a; cin >> a; c[i] = 1; while(a % 2 == 0){ a /= 2; c[i] *= 2; } v[i] = a; c[i] += c[i - 1]; } int q; cin >> q; while(q--){ ll x; cin >> x; int pos = lower_bound(iter(c), x) - c.begin(); cout << v[pos] << "\n"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...