Submission #715273

#TimeUsernameProblemLanguageResultExecution timeMemory
715273alextodoranIntercastellar (JOI22_ho_t1)C++17
100 / 100
84 ms9172 KiB
/** ____ ____ ____ ____ ____ ||a |||t |||o |||d |||o || ||__|||__|||__|||__|||__|| |/__\|/__\|/__\|/__\|/__\| **/ #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N_MAX = 200000; const int Q_MAX = 200000; int N, Q; ll A[N_MAX + 2]; ll pref[N_MAX + 2]; int main () { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> N; for (int i = 1; i <= N; i++) { cin >> A[i]; pref[i] = 1; while (A[i] % 2 == 0) { A[i] /= 2; pref[i] *= 2; } pref[i] += pref[i - 1]; } cin >> Q; while (Q--) { ll X; cin >> X; int l = 1, r = N; while (l < r) { int mid = (l + r) / 2; if (X <= pref[mid]) { r = mid; } else { l = mid + 1; } } cout << A[l] << "\n"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...