#include <bits/stdc++.h>
#define endl '\n'
#define int long long
using namespace std;
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)cin>>a[i];
int q,x;
cin>>q;
int ei,ind=0;
int num=a[ind++],cnt=0;
while(num%2==0){num>>=1;cnt++;}
ei=(1<<cnt);
for(int i=0;i<q;i++){
cin>>x;
while(x>ei){
cnt=0;
num=a[ind++];
while(num%2==0){num>>=1;cnt++;}
ei+=(1<<cnt);
}
cout<<num<<endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
12 ms |
1884 KB |
Output is correct |
4 |
Correct |
16 ms |
1076 KB |
Output is correct |
5 |
Correct |
28 ms |
2248 KB |
Output is correct |
6 |
Correct |
17 ms |
1884 KB |
Output is correct |
7 |
Correct |
28 ms |
2388 KB |
Output is correct |
8 |
Correct |
27 ms |
2336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 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 |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
464 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
472 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
12 ms |
1884 KB |
Output is correct |
4 |
Correct |
16 ms |
1076 KB |
Output is correct |
5 |
Correct |
28 ms |
2248 KB |
Output is correct |
6 |
Correct |
17 ms |
1884 KB |
Output is correct |
7 |
Correct |
28 ms |
2388 KB |
Output is correct |
8 |
Correct |
27 ms |
2336 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
344 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 |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
344 KB |
Output is correct |
18 |
Correct |
0 ms |
464 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
344 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
472 KB |
Output is correct |
23 |
Correct |
17 ms |
2912 KB |
Output is correct |
24 |
Correct |
22 ms |
4176 KB |
Output is correct |
25 |
Correct |
39 ms |
7252 KB |
Output is correct |
26 |
Correct |
26 ms |
4692 KB |
Output is correct |
27 |
Correct |
24 ms |
4504 KB |
Output is correct |
28 |
Correct |
47 ms |
7764 KB |
Output is correct |
29 |
Correct |
47 ms |
7256 KB |
Output is correct |
30 |
Correct |
23 ms |
3668 KB |
Output is correct |
31 |
Correct |
44 ms |
7508 KB |
Output is correct |