Submission #979109

#TimeUsernameProblemLanguageResultExecution timeMemory
979109vjudge1Intercastellar (JOI22_ho_t1)C++17
0 / 100
30 ms16256 KiB
#include<bits/stdc++.h> #define ft first #define sd second #define pb push_back #define nl "\n" #define int ll typedef long long ll; typedef long double ld; using namespace std; const int mod = 1e9 + 7; const int N = 2000; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int T = 1; while(T--) { int n; cin >> n; int a[n + 1]; vector<vector<int>> v; for (int i = 1; i <= n; i++) { cin >> a[i]; int cnt = 1; while(a[i] % 2 == 0) { cnt *= 2; a[i] /= 2; } v.push_back({cnt, a[i]}); } int pre[n + 3]; pre[0] = 0; //cout << pre[0] << ' '; for (int i = 1; i < n; i++) { pre[i] = pre[i - 1] + v[i - 1][0]; // cout << pre[i] << ' '; } //cout << nl; int q; cin >> q; while(q--) { int x; cin >> x; int l = 0, r = n + 1; while(l + 1 < r) { int m = (l + r) / 2; if (x > pre[m]) { l = m; } else { r = m; } } cout << v[l][1] << nl; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...