#include <bits/stdc++.h>
#define speed ios_base::sync_with_stdio(0); cin.tie(0)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef long double ldb;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MAX=2e5+10,P=998244353;
const ll INF=0x3f3f3f3f,oo=0x3f3f3f3f3f3f3f3f;
int n,q;
ll a[MAX];
ll pre[MAX];
int main() {
speed;
cin>>n;
pre[0]=0;
for (int i=1;i<=n;i++) {
cin>>a[i];
ll num=0;
while (a[i]%2==0) {
a[i]/=2;
num++;
}
pre[i]=pre[i-1]+(1ll<<num);
}
cin>>q;
while (q--) {
ll x;
cin>>x;
int id=lower_bound(pre+1,pre+n+1,x)-pre;
cout<<a[id]<<"\n";
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
15 ms |
4084 KB |
Output is correct |
4 |
Correct |
23 ms |
3932 KB |
Output is correct |
5 |
Correct |
38 ms |
5460 KB |
Output is correct |
6 |
Correct |
23 ms |
4432 KB |
Output is correct |
7 |
Correct |
38 ms |
5640 KB |
Output is correct |
8 |
Correct |
40 ms |
5712 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2392 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
6 |
Correct |
1 ms |
2396 KB |
Output is correct |
7 |
Correct |
1 ms |
2396 KB |
Output is correct |
8 |
Correct |
1 ms |
2396 KB |
Output is correct |
9 |
Correct |
1 ms |
2396 KB |
Output is correct |
10 |
Correct |
1 ms |
2396 KB |
Output is correct |
11 |
Correct |
1 ms |
2392 KB |
Output is correct |
12 |
Correct |
1 ms |
2404 KB |
Output is correct |
13 |
Correct |
1 ms |
2396 KB |
Output is correct |
14 |
Correct |
1 ms |
2396 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
15 ms |
4084 KB |
Output is correct |
4 |
Correct |
23 ms |
3932 KB |
Output is correct |
5 |
Correct |
38 ms |
5460 KB |
Output is correct |
6 |
Correct |
23 ms |
4432 KB |
Output is correct |
7 |
Correct |
38 ms |
5640 KB |
Output is correct |
8 |
Correct |
40 ms |
5712 KB |
Output is correct |
9 |
Correct |
1 ms |
2396 KB |
Output is correct |
10 |
Correct |
1 ms |
2392 KB |
Output is correct |
11 |
Correct |
1 ms |
2396 KB |
Output is correct |
12 |
Correct |
1 ms |
2396 KB |
Output is correct |
13 |
Correct |
1 ms |
2396 KB |
Output is correct |
14 |
Correct |
1 ms |
2396 KB |
Output is correct |
15 |
Correct |
1 ms |
2396 KB |
Output is correct |
16 |
Correct |
1 ms |
2396 KB |
Output is correct |
17 |
Correct |
1 ms |
2396 KB |
Output is correct |
18 |
Correct |
1 ms |
2396 KB |
Output is correct |
19 |
Correct |
1 ms |
2392 KB |
Output is correct |
20 |
Correct |
1 ms |
2404 KB |
Output is correct |
21 |
Correct |
1 ms |
2396 KB |
Output is correct |
22 |
Correct |
1 ms |
2396 KB |
Output is correct |
23 |
Correct |
25 ms |
4764 KB |
Output is correct |
24 |
Correct |
27 ms |
5960 KB |
Output is correct |
25 |
Correct |
52 ms |
8788 KB |
Output is correct |
26 |
Correct |
35 ms |
6228 KB |
Output is correct |
27 |
Correct |
31 ms |
5980 KB |
Output is correct |
28 |
Correct |
60 ms |
9276 KB |
Output is correct |
29 |
Correct |
56 ms |
8788 KB |
Output is correct |
30 |
Correct |
31 ms |
5724 KB |
Output is correct |
31 |
Correct |
60 ms |
9124 KB |
Output is correct |