이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define ld long double
#define pi pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define debug(x) cout << #x << " => " << x << "\n"
int main()
{
ios_base::sync_with_stdio(false);cin.tie(NULL);
ll pow[31];
pow[0]=1;
for(ll i=1;i<31;i++) pow[i]=pow[i-1]*2;
ll n;cin>>n;
ll a[n],b[n];
for(ll i=0;i<n;i++)
{
ll x;cin>>x;
for(ll j=30;j>=0;j--)
{
if(x%pow[j]==0)
{
a[i]=pow[j];
b[i]=x/pow[j];
break;
}
}
}
for(ll i=1;i<n;i++) a[i]+=a[i-1];
ll q;cin>>q;
while(q--)
{
ll x;cin>>x;
ll p=lower_bound(a,a+n,x)-a;
cout<<b[p]<<endl;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |