Submission #529420

#TimeUsernameProblemLanguageResultExecution timeMemory
529420fhvirusIntercastellar (JOI22_ho_t1)C++17
100 / 100
70 ms4496 KiB
#include <bits/stdc++.h> using namespace std; typedef int64_t ll; typedef pair<int, int> pii; #define pb emplace_back #define AI(x) begin(x),end(x) #define ff first #define ss second #ifdef OWO #define debug(args...) LKJ("\033[0;32m[ " + string(#args) + " ]\033[0m", args) template<class I> void LKJ(I&&x) { cerr << x << endl; } template<class I, class...T> void LKJ(I&&x, T&&...t) { cerr << x << ", "; LKJ(t...); } template<class I> void OI(I a, I b) { while (a < b) cerr << *a << " \n"[next(a) == b]; } #else #define debug(...) 0 #define OI(...) 0 #endif signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int N; cin >> N; vector<int> A(N + 1); for (int i = 1; i <= N; ++i) cin >> A[i]; vector<ll> B(N + 1); for (int i = 1; i <= N; ++i) { int low = (A[i] & -A[i]); A[i] /= low; B[i] = B[i - 1] + low; } int Q; cin >> Q; for (int i = 0; i < Q; ++i) { ll X; cin >> X; int p = lower_bound(AI(B), X) - begin(B); cout << A[p] << '\n'; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...