제출 #1143530

#제출 시각아이디문제언어결과실행 시간메모리
1143530fryingducIntercastellar (JOI22_ho_t1)C++20
100 / 100
71 ms4676 KiB
#include "bits/stdc++.h"
using namespace std;

#ifdef duc_debug
#include "bits/debug.h"
#else
#define debug(...)
#endif

const int maxn = 2e5 + 5;
int n, a[maxn];
long long ps[maxn];
int q;

void solve() {
  cin >> n;
  for(int i = 1; i <= n; ++i) {
    cin >> a[i];
    while(a[i] % 2 == 0) {
      ++ps[i];
      a[i] >>= 1;
    }
    ps[i] = (1ll << ps[i]);
    ps[i] += ps[i - 1];
  }
  cin >> q;
  for(int i = 1; i <= q; ++i) {
    long long x; cin >> x;
    int lb = lower_bound(ps, ps + n + 1, x) - ps;
    cout << a[lb] << '\n';
  }
} 

signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  solve();

  return 0;
}


#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...