Submission #828127

#TimeUsernameProblemLanguageResultExecution timeMemory
828127RaresFelixIntercastellar (JOI22_ho_t1)C++17
100 / 100
361 ms9156 KiB
#include <bits/stdc++.h> using namespace std; const int MN = 200001; using ll = long long; ll n, q, A[MN], S[MN]; int main() { cin >> n; for(int i = 1; i <= n; ++i) { cin >> A[i]; S[i] = 1; while(!(A[i] & 1)) { A[i] >>= 1; S[i] <<= 1; } S[i] += S[i - 1]; } cin >> q; for(int i = 1; i <= q; ++i) { ll p; cin >> p; int st = 1, dr = n, mij; while(st < dr) { mij = (st + dr) / 2; if(S[mij] < p) st = mij + 1; else dr = mij; } cout << A[st] << "\n"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...