#include<bits/stdc++.h>
#define ll 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;
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()==0)
posi.emplace_back(size);
else
posi.emplace_back(posi[posi.size()-1]+size);
value.emplace_back(num/size);
}
// for(int i=1;i<=n;i++)
// {
// cout<<posi[i]<<" ";
// }
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 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
452 KB |
Output is correct |
3 |
Correct |
20 ms |
4288 KB |
Output is correct |
4 |
Correct |
24 ms |
2512 KB |
Output is correct |
5 |
Correct |
42 ms |
5820 KB |
Output is correct |
6 |
Correct |
25 ms |
4288 KB |
Output is correct |
7 |
Correct |
46 ms |
5876 KB |
Output is correct |
8 |
Correct |
44 ms |
5872 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
452 KB |
Output is correct |
3 |
Correct |
20 ms |
4288 KB |
Output is correct |
4 |
Correct |
24 ms |
2512 KB |
Output is correct |
5 |
Correct |
42 ms |
5820 KB |
Output is correct |
6 |
Correct |
25 ms |
4288 KB |
Output is correct |
7 |
Correct |
46 ms |
5876 KB |
Output is correct |
8 |
Correct |
44 ms |
5872 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
33 ms |
3276 KB |
Output is correct |
24 |
Correct |
52 ms |
5740 KB |
Output is correct |
25 |
Correct |
88 ms |
9064 KB |
Output is correct |
26 |
Correct |
58 ms |
5704 KB |
Output is correct |
27 |
Correct |
57 ms |
5812 KB |
Output is correct |
28 |
Correct |
94 ms |
9532 KB |
Output is correct |
29 |
Correct |
107 ms |
9020 KB |
Output is correct |
30 |
Correct |
35 ms |
4044 KB |
Output is correct |
31 |
Correct |
102 ms |
9384 KB |
Output is correct |