#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll, ll>
#define pii pair<int, int>
#define fs first
#define sc second
#define pb push_back
void solve() {
int n;
cin>>n;
pll a[n];
ll p=0;
for(int i=0;i<n;i++){
cin>>a[i].sc;
a[i].fs=1;
while((a[i].sc)%2==0){
a[i].sc>>=1;
a[i].fs<<=1;
}
a[i].fs+=p;
p=a[i].fs;
}
int q;
cin>>q;
while(q--){
ll x;
cin>>x;
pll p={x,0};
cout<<(*lower_bound(a,a+n,p)).sc<<'\n';
}
}
int main() {
#ifdef FPO
freopen("in","r",stdin);
freopen("out","w",stdout);
#endif
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
15 ms |
4308 KB |
Output is correct |
4 |
Correct |
22 ms |
2384 KB |
Output is correct |
5 |
Correct |
37 ms |
5448 KB |
Output is correct |
6 |
Correct |
21 ms |
4176 KB |
Output is correct |
7 |
Correct |
36 ms |
5708 KB |
Output is correct |
8 |
Correct |
35 ms |
5572 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
480 KB |
Output is correct |
12 |
Correct |
1 ms |
336 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
14 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
15 ms |
4308 KB |
Output is correct |
4 |
Correct |
22 ms |
2384 KB |
Output is correct |
5 |
Correct |
37 ms |
5448 KB |
Output is correct |
6 |
Correct |
21 ms |
4176 KB |
Output is correct |
7 |
Correct |
36 ms |
5708 KB |
Output is correct |
8 |
Correct |
35 ms |
5572 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
336 KB |
Output is correct |
12 |
Correct |
1 ms |
336 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
14 |
Correct |
1 ms |
336 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
1 ms |
336 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
480 KB |
Output is correct |
20 |
Correct |
1 ms |
336 KB |
Output is correct |
21 |
Correct |
1 ms |
336 KB |
Output is correct |
22 |
Correct |
1 ms |
336 KB |
Output is correct |
23 |
Correct |
20 ms |
3152 KB |
Output is correct |
24 |
Correct |
33 ms |
5340 KB |
Output is correct |
25 |
Correct |
48 ms |
8940 KB |
Output is correct |
26 |
Correct |
41 ms |
5704 KB |
Output is correct |
27 |
Correct |
40 ms |
5720 KB |
Output is correct |
28 |
Correct |
57 ms |
9288 KB |
Output is correct |
29 |
Correct |
51 ms |
8776 KB |
Output is correct |
30 |
Correct |
30 ms |
3664 KB |
Output is correct |
31 |
Correct |
57 ms |
9252 KB |
Output is correct |