#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
long long int arr[n];
long long int a[n],b[n];
for(int i=0;i<n;i++){
cin>>arr[i];
long long int bro=1;
while(arr[i]%2==0){
bro=bro*2;
arr[i]=arr[i]/2;
}
a[i]=arr[i];
b[i]=bro;
// cout<<a[i]<<" "<<b[i]<<endl;
}
int q;
cin>>q;
int i=0;
long long int sum=1;
while(q--){
long long int x;
cin>>x;
int t1=0;
while(t1==0){
if((sum+b[i])<=x){
sum=sum+b[i];
i++;
}else{
break;
}
}
cout<<a[i]<<endl;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
95 ms |
5668 KB |
Output is correct |
4 |
Correct |
240 ms |
2700 KB |
Output is correct |
5 |
Correct |
374 ms |
7000 KB |
Output is correct |
6 |
Correct |
174 ms |
5344 KB |
Output is correct |
7 |
Correct |
364 ms |
7004 KB |
Output is correct |
8 |
Correct |
340 ms |
7100 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
300 KB |
Output is correct |
2 |
Correct |
1 ms |
296 KB |
Output is correct |
3 |
Correct |
1 ms |
296 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
300 KB |
Output is correct |
6 |
Correct |
1 ms |
304 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
3 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
300 KB |
Output is correct |
11 |
Correct |
3 ms |
340 KB |
Output is correct |
12 |
Correct |
3 ms |
316 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
3 ms |
312 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
95 ms |
5668 KB |
Output is correct |
4 |
Correct |
240 ms |
2700 KB |
Output is correct |
5 |
Correct |
374 ms |
7000 KB |
Output is correct |
6 |
Correct |
174 ms |
5344 KB |
Output is correct |
7 |
Correct |
364 ms |
7004 KB |
Output is correct |
8 |
Correct |
340 ms |
7100 KB |
Output is correct |
9 |
Correct |
1 ms |
300 KB |
Output is correct |
10 |
Correct |
1 ms |
296 KB |
Output is correct |
11 |
Correct |
1 ms |
296 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
300 KB |
Output is correct |
14 |
Correct |
1 ms |
304 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
3 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
300 KB |
Output is correct |
19 |
Correct |
3 ms |
340 KB |
Output is correct |
20 |
Correct |
3 ms |
316 KB |
Output is correct |
21 |
Correct |
1 ms |
212 KB |
Output is correct |
22 |
Correct |
3 ms |
312 KB |
Output is correct |
23 |
Correct |
211 ms |
3184 KB |
Output is correct |
24 |
Correct |
183 ms |
6320 KB |
Output is correct |
25 |
Correct |
438 ms |
10336 KB |
Output is correct |
26 |
Correct |
238 ms |
6452 KB |
Output is correct |
27 |
Correct |
209 ms |
6696 KB |
Output is correct |
28 |
Correct |
446 ms |
10720 KB |
Output is correct |
29 |
Correct |
462 ms |
10220 KB |
Output is correct |
30 |
Correct |
285 ms |
3844 KB |
Output is correct |
31 |
Correct |
453 ms |
10740 KB |
Output is correct |