이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int a[200100];
void solve(){
int n;
cin>>n;
for(int i=1; i<=n; i++){
cin>>a[i];
}
ll d=0;
int t;
cin>>t;
ll x = 1;
while(t--){
ll g;
cin>>g;
while(true){
ll k = a[x];
ll h = 1;
while(k % 2 == 0) k /= 2, h*=2;
if(g - d <= h){
cout<<k<<'\n';
break;
}
d += h;
x ++;
}
}
}
int main(){
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... |