| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1307507 | ikkyu | Intercastellar (JOI22_ho_t1) | C++20 | 55 ms | 5628 KiB |
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 3e5 + 5, M = 1e9 + 7, LG = 20;
int n , A[N] , x , q;
void solve(){
cin >> n;
vector<int> s(1 , 0);
for (int i=1 ; i<=n ; i++){
cin >> x;
int cn = 1;
while(!(x&1)){
cn *= 2;
x /= 2;
}
s.push_back(s.back() + cn);
A[i] = x;
}
cin >> q;
while(q--){
cin >> x;
int l = 0 , r = s.size();
while(l+1 < r){
int m = (l+r)>>1;
if (s[m] < x){
l = m;
}else{
r = m;
}
}
cout << A[l+1] << "\n";
}
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
solve();
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
