제출 #1032411

#제출 시각아이디문제언어결과실행 시간메모리
1032411nguyendinhanh1508Intercastellar (JOI22_ho_t1)C++14
25 / 100
357 ms524288 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mx 1000007
#define inf LLONG_MAX/20
#define pi pair<int, int>
#define mp make_pair

int a[mx];

int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }
  vector<int> vec;
  for(int i = 0; i < n; i++){
    int count = 1;
    while(a[i] % 2 == 0){
      a[i] /= 2;
      count *= 2;
    }
    for(int j = 0; j < count; j++){
      vec.push_back(a[i]);
    }
  }
  int q;
  cin >> q;
  while(q--){
    int x;
    cin >> x;
    cout << vec[x - 1] << '\n';
  }
  return 0; 
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...