제출 #1123501

#제출 시각아이디문제언어결과실행 시간메모리
1123501LucaIlieIntercastellar (JOI22_ho_t1)C++20
25 / 100
302 ms3164 KiB
#include <bits/stdc++.h> using namespace std; const int MAX_N = 2e5; int v[MAX_N + 2]; long long frecvPart[MAX_N + 1]; int main() { int n; cin >> n; for ( int i = 1; i <= n; i++ ) { int x; cin >> x; int r = 1; while ( x % 2 == 0 ) { x /= 2; r *= 2; } frecvPart[i] = frecvPart[i - 1] + r; v[i] = x; } int q; cin >> q; for ( int i = 0; i < q; i++ ) { int a; cin >> a; int l = 0, r = n; while ( r - l > 1 ) { int mid = (l + r) / 2; if ( frecvPart[mid] < a ) l = mid; else r = mid; } cout << v[r] << "\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...