#include<bits/stdc++.h>
using namespace std;
#define ll long long
int a[200100];
void solve(){
int n;
cin>>n;
for(int i=1; i<=n; i++){
cin>>a[i];
}
ll d=0;
int t;
cin>>t;
ll x = 1;
while(t--){
ll g;
cin>>g;
while(true){
ll k = a[x];
ll h = 1;
while(k % 2 == 0) k /= 2, h*=2;
if(g - d <= h){
cout<<k<<'\n';
break;
}
d += h;
x ++;
}
}
}
int main(){
solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
63 ms |
1864 KB |
Output is correct |
4 |
Correct |
203 ms |
2140 KB |
Output is correct |
5 |
Correct |
266 ms |
3152 KB |
Output is correct |
6 |
Correct |
136 ms |
2168 KB |
Output is correct |
7 |
Correct |
275 ms |
3152 KB |
Output is correct |
8 |
Correct |
265 ms |
3268 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 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 |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
2 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
3 ms |
348 KB |
Output is correct |
12 |
Correct |
2 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
2 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
63 ms |
1864 KB |
Output is correct |
4 |
Correct |
203 ms |
2140 KB |
Output is correct |
5 |
Correct |
266 ms |
3152 KB |
Output is correct |
6 |
Correct |
136 ms |
2168 KB |
Output is correct |
7 |
Correct |
275 ms |
3152 KB |
Output is correct |
8 |
Correct |
265 ms |
3268 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 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 |
344 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
2 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
3 ms |
348 KB |
Output is correct |
20 |
Correct |
2 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
2 ms |
348 KB |
Output is correct |
23 |
Correct |
161 ms |
2700 KB |
Output is correct |
24 |
Correct |
142 ms |
3660 KB |
Output is correct |
25 |
Correct |
309 ms |
6432 KB |
Output is correct |
26 |
Correct |
189 ms |
4124 KB |
Output is correct |
27 |
Correct |
159 ms |
3920 KB |
Output is correct |
28 |
Correct |
337 ms |
6984 KB |
Output is correct |
29 |
Correct |
350 ms |
6432 KB |
Output is correct |
30 |
Correct |
229 ms |
3408 KB |
Output is correct |
31 |
Correct |
347 ms |
6996 KB |
Output is correct |