#include <bits/stdc++.h>
#define endl "\n"
#define finp for(int i=0; i<n; i++)
#define fknp for(int k=0; k<n; k++)
#define yeap cout<<"YES"<<endl
#define nope cout<<"NO"<<endl
#define inpintn int n; cin>>n
#define inpintarrn int arr[n]; for(int i=0; i<n; i++){cin>>arr[i];}
#define inpllarrn long long arr[n]; for(int i=0; i<n; i++){cin>>arr[i];}
#define ll long long
ll expo(ll n){
ll count=0;
while(n%2==0){
count++;
n/=2;
}
return count;
}
using namespace std;
int main ()
{
ll n;
cin>>n;
ll arr[n];
for (int i=0; i<n; i++){
cin>>arr[i];
}
ll q;
cin>>q;
ll brr[q];
for (int i=0; i<q; i++){
cin>>brr[i];
}
vector<ll> ans;
for (int i=0; i<n; i++){
ll a=expo(arr[i]);
if(a==0){
ans.push_back(arr[i]);
} else {
ll b=pow(2,a);
ll c=arr[i]/b;
for (int k=0; k<b; k++){
ans.push_back(c);
}
}
}
for (int l=0; l<q; l++){
ll d=ans[brr[l]-1];
cout << d << " ";
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
43 ms |
6876 KB |
Output is correct |
4 |
Correct |
55 ms |
4136 KB |
Output is correct |
5 |
Correct |
97 ms |
9488 KB |
Output is correct |
6 |
Correct |
64 ms |
11640 KB |
Output is correct |
7 |
Correct |
108 ms |
13460 KB |
Output is correct |
8 |
Correct |
127 ms |
21800 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
300 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Runtime error |
414 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
43 ms |
6876 KB |
Output is correct |
4 |
Correct |
55 ms |
4136 KB |
Output is correct |
5 |
Correct |
97 ms |
9488 KB |
Output is correct |
6 |
Correct |
64 ms |
11640 KB |
Output is correct |
7 |
Correct |
108 ms |
13460 KB |
Output is correct |
8 |
Correct |
127 ms |
21800 KB |
Output is correct |
9 |
Correct |
0 ms |
300 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Runtime error |
414 ms |
524288 KB |
Execution killed with signal 9 |
12 |
Halted |
0 ms |
0 KB |
- |