| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1330493 | thondon | Intercastellar (JOI22_ho_t1) | C++17 | 58 ms | 5576 KiB |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
signed main(){
cin.tie(0)->sync_with_stdio(0);
int N,Q;
ll A;
vector<pair<ll,ll>> Index;
cin>>N;
while(N--){
cin>>A;
ll grow_rate=1;
if(Index.empty()) Index.emplace_back(0,0);
else Index.emplace_back(Index.back().first,0);
while((A&1)==0){
A/=2;
grow_rate*=2;
}
Index.back().first+=grow_rate;
Index.back().second=A;
}
cin>>Q;
while(Q--){
ll x;
cin>>x;
int l=0,r=Index.size()-1;
ll ans=0;
while(l<=r){
int mid=(l+r)/2;
if(x <= Index[mid].first){
ans=Index[mid].second;
r=mid-1;
}else l=mid+1;
}
cout<<ans<<"\n";
}
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
