#include<bits/stdc++.h>
#define ll long long
#define int long long
using namespace std;
ll n,two[37];
vector<ll> posi,value;
signed main()
{
ios_base::sync_with_stdio(false);cin.tie(nullptr);
for(int i=0;i<=30;i++)
{
two[i]=(1<<i);
}
cin>>n;
posi.emplace_back(1);
value.emplace_back(-1);
for(int i=1;i<=n;i++)
{
ll num;
cin>>num;
ll size=0;
for(int i=0;i<=30;i++)
{
if(two[i]>num) break;
if(num%two[i]==0)
{
size=two[i];
}
}
if(posi.size()==1)
posi.emplace_back(size);
else
posi.emplace_back(posi[posi.size()-1]+size);
value.emplace_back(num/size);
}
int q;
cin>>q;
while(q--)
{
ll tmp;
cin>>tmp;
int it=lower_bound(posi.begin(),posi.end(),tmp)-posi.begin();
cout<<value[it]<<"\n";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |