제출 #1274248

#제출 시각아이디문제언어결과실행 시간메모리
1274248MisterReaperIntercastellar (JOI22_ho_t1)C++20
100 / 100
54 ms5312 KiB
// File intercastellar.cpp created on 29.09.2025 at 19:11:02 #include <bits/stdc++.h> using i64 = long long; #ifdef DEBUG #include "/home/ahmetalp/Desktop/Workplace/debug.h" #else #define debug(...) void(23) #endif int f(int x) { int res = 1; while (~x & 1) { res <<= 1; x >>= 1; } return res; } int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int N; std::cin >> N; std::vector<int> A(N); for (int i = 0; i < N; ++i) { std::cin >> A[i]; } std::vector<int> val(N); std::vector<i64> pre(N + 1); for (int i = 0; i < N; ++i) { val[i] = f(A[i]); pre[i + 1] = pre[i] + val[i]; } debug(pre); int Q; std::cin >> Q; while (Q--) { i64 X; std::cin >> X; int j = int(std::lower_bound(pre.begin(), pre.end(), X) - pre.begin() - 1); std::cout << A[j] / f(A[j]) << '\n'; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...