#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
const int N=2e5;
int tab[N+10];
int ans[N+10];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n,q;
cin>>n;
for(int i=1;i<=n;i++)
cin>>tab[i];
cin>>q;
long long cnt=0;
int k=0;
for(int i=1;i<=q;i++)
{
long long x;
cin>>x;
while(cnt<x)
{
k++;
long long c=1;
while(tab[k]%2==0)
{
tab[k]/=2;
c*=2;
}
cnt+=c;
}
cout<<tab[k]<<"\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 |
17 ms |
1560 KB |
Output is correct |
4 |
Correct |
25 ms |
1572 KB |
Output is correct |
5 |
Correct |
44 ms |
2492 KB |
Output is correct |
6 |
Correct |
23 ms |
2028 KB |
Output is correct |
7 |
Correct |
42 ms |
2692 KB |
Output is correct |
8 |
Correct |
45 ms |
3220 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
324 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
320 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
332 KB |
Output is correct |
8 |
Correct |
1 ms |
324 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
0 ms |
204 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 |
328 KB |
Output is correct |
14 |
Correct |
1 ms |
336 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 |
17 ms |
1560 KB |
Output is correct |
4 |
Correct |
25 ms |
1572 KB |
Output is correct |
5 |
Correct |
44 ms |
2492 KB |
Output is correct |
6 |
Correct |
23 ms |
2028 KB |
Output is correct |
7 |
Correct |
42 ms |
2692 KB |
Output is correct |
8 |
Correct |
45 ms |
3220 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
324 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
320 KB |
Output is correct |
14 |
Correct |
1 ms |
204 KB |
Output is correct |
15 |
Correct |
1 ms |
332 KB |
Output is correct |
16 |
Correct |
1 ms |
324 KB |
Output is correct |
17 |
Correct |
1 ms |
204 KB |
Output is correct |
18 |
Correct |
0 ms |
204 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 |
328 KB |
Output is correct |
22 |
Correct |
1 ms |
336 KB |
Output is correct |
23 |
Correct |
24 ms |
2384 KB |
Output is correct |
24 |
Correct |
30 ms |
3164 KB |
Output is correct |
25 |
Correct |
59 ms |
5636 KB |
Output is correct |
26 |
Correct |
44 ms |
3632 KB |
Output is correct |
27 |
Correct |
36 ms |
3268 KB |
Output is correct |
28 |
Correct |
71 ms |
6600 KB |
Output is correct |
29 |
Correct |
69 ms |
5536 KB |
Output is correct |
30 |
Correct |
37 ms |
3272 KB |
Output is correct |
31 |
Correct |
70 ms |
6504 KB |
Output is correct |