#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
95 ms |
3924 KB |
Output is correct |
4 |
Correct |
213 ms |
2228 KB |
Output is correct |
5 |
Correct |
315 ms |
5520 KB |
Output is correct |
6 |
Correct |
165 ms |
4064 KB |
Output is correct |
7 |
Correct |
314 ms |
5536 KB |
Output is correct |
8 |
Correct |
307 ms |
5620 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
320 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
324 KB |
Output is correct |
7 |
Correct |
1 ms |
320 KB |
Output is correct |
8 |
Correct |
2 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
2 ms |
340 KB |
Output is correct |
12 |
Correct |
2 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
2 ms |
328 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
95 ms |
3924 KB |
Output is correct |
4 |
Correct |
213 ms |
2228 KB |
Output is correct |
5 |
Correct |
315 ms |
5520 KB |
Output is correct |
6 |
Correct |
165 ms |
4064 KB |
Output is correct |
7 |
Correct |
314 ms |
5536 KB |
Output is correct |
8 |
Correct |
307 ms |
5620 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
320 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
324 KB |
Output is correct |
15 |
Correct |
1 ms |
320 KB |
Output is correct |
16 |
Correct |
2 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
2 ms |
340 KB |
Output is correct |
20 |
Correct |
2 ms |
340 KB |
Output is correct |
21 |
Correct |
1 ms |
340 KB |
Output is correct |
22 |
Correct |
2 ms |
328 KB |
Output is correct |
23 |
Correct |
198 ms |
2972 KB |
Output is correct |
24 |
Correct |
159 ms |
5176 KB |
Output is correct |
25 |
Correct |
330 ms |
8688 KB |
Output is correct |
26 |
Correct |
187 ms |
5480 KB |
Output is correct |
27 |
Correct |
171 ms |
5464 KB |
Output is correct |
28 |
Correct |
323 ms |
9184 KB |
Output is correct |
29 |
Correct |
321 ms |
8692 KB |
Output is correct |
30 |
Correct |
220 ms |
3720 KB |
Output is correct |
31 |
Correct |
347 ms |
9128 KB |
Output is correct |