Submission #657237

#TimeUsernameProblemLanguageResultExecution timeMemory
657237happypotatoIntercastellar (JOI22_ho_t1)C++17
100 / 100
420 ms7644 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<pair<int, int>> v(n); for (int i = 0; i < n; i++) { cin >> v[i].first; v[i].second = 1; while (!bool(v[i].first & 1)) { v[i].first >>= 1; v[i].second <<= 1; } } int q; cin >> q; int ptr = 0; long long ps = 0; while (q--) { long long x; cin >> x; while (x - ps > v[ptr].second) { ps += v[ptr].second; ptr++; } cout << v[ptr].first << endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...