#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Forr(i,a,b) for(int i=a;i>=b;i--)
#define F first
#define S second
#define sz(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define INF (ll)(9e18)
#define int LL
using namespace std;
using LL=long long;
using pii=pair<int,int>;
int x[200020];
int s[200020];
int32_t main(){
ios::sync_with_stdio(false);
cin.tie(0);
// OAO
int n; cin>>n;
For(i,1,n){
int t; cin>>t;
int c=1;
while((~t)&1){
t>>=1;
c<<=1;
}
s[i]=s[i-1]+c;
x[i]=t;
}
int q; cin>>q;
while(q--){
int t; cin>>t;
auto it=lower_bound(s,s+n+1,t)-s;
cout<<x[it]<<"\n";
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
18 ms |
3344 KB |
Output is correct |
4 |
Correct |
28 ms |
1324 KB |
Output is correct |
5 |
Correct |
48 ms |
3948 KB |
Output is correct |
6 |
Correct |
28 ms |
3096 KB |
Output is correct |
7 |
Correct |
54 ms |
3788 KB |
Output is correct |
8 |
Correct |
50 ms |
3744 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
332 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
1 ms |
332 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
9 |
Correct |
1 ms |
332 KB |
Output is correct |
10 |
Correct |
1 ms |
332 KB |
Output is correct |
11 |
Correct |
1 ms |
332 KB |
Output is correct |
12 |
Correct |
1 ms |
332 KB |
Output is correct |
13 |
Correct |
1 ms |
332 KB |
Output is correct |
14 |
Correct |
1 ms |
332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
18 ms |
3344 KB |
Output is correct |
4 |
Correct |
28 ms |
1324 KB |
Output is correct |
5 |
Correct |
48 ms |
3948 KB |
Output is correct |
6 |
Correct |
28 ms |
3096 KB |
Output is correct |
7 |
Correct |
54 ms |
3788 KB |
Output is correct |
8 |
Correct |
50 ms |
3744 KB |
Output is correct |
9 |
Correct |
0 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
0 ms |
204 KB |
Output is correct |
12 |
Correct |
0 ms |
332 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
1 ms |
332 KB |
Output is correct |
15 |
Correct |
1 ms |
332 KB |
Output is correct |
16 |
Correct |
1 ms |
332 KB |
Output is correct |
17 |
Correct |
1 ms |
332 KB |
Output is correct |
18 |
Correct |
1 ms |
332 KB |
Output is correct |
19 |
Correct |
1 ms |
332 KB |
Output is correct |
20 |
Correct |
1 ms |
332 KB |
Output is correct |
21 |
Correct |
1 ms |
332 KB |
Output is correct |
22 |
Correct |
1 ms |
332 KB |
Output is correct |
23 |
Correct |
25 ms |
1988 KB |
Output is correct |
24 |
Correct |
31 ms |
3332 KB |
Output is correct |
25 |
Correct |
83 ms |
5356 KB |
Output is correct |
26 |
Correct |
47 ms |
2908 KB |
Output is correct |
27 |
Correct |
38 ms |
3012 KB |
Output is correct |
28 |
Correct |
74 ms |
4572 KB |
Output is correct |
29 |
Correct |
71 ms |
3820 KB |
Output is correct |
30 |
Correct |
41 ms |
1388 KB |
Output is correct |
31 |
Correct |
77 ms |
4324 KB |
Output is correct |