#include <bits/stdc++.h>
#define ll long long
#define str string
#define ins insert
#define ld long double
#define pb push_back
#define pf push_front
#define pof pop_front()
#define pob pop_back()
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
#define fr first
#define sc second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define sz size()
#define vll vector<ll>
#define bc back()
#define arr array
#define pll vector<pair<ll,ll>>
using namespace std;
template <class _T>
bool chmin(_T &x, const _T &y){
bool f=0;
if (x>y){x=y;f=1;}
return f;
}
template <class _T>
bool chmax(_T &x, const _T &y){
bool f=0;
if (x<y){x=y;f=1;}
return f;
}
//void fre(string s){freopen((s+".in").c_str(),"r",stdin);freopen((s+".out").c_str(),"w",stdout);}
void start(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
const ll inf=1e18+7;
const ll mod=1e9+7;
const ll N=1e5+7;
const ld eps=1e-9;
void solve(){
ll i,j;
ll n;
cin>>n;
vll v;
ll b;
for(i=0;i<n;i++){
cin>>b;
ll c=1;
while(b%2==0){
b/=2;
c*=2;
}
for(j=0;j<c;j++) v.pb(b);
}
cin>>n;
for(i=0;i<n;i++){
cin>>b;
cout<<v[b-1]<<endl;
}
}
signed main(){
start();
ll t=1;
//cin>>t;
while(t--) solve();
return 0;
}
/*
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
16 ms |
6352 KB |
Output is correct |
4 |
Correct |
22 ms |
2776 KB |
Output is correct |
5 |
Correct |
36 ms |
6868 KB |
Output is correct |
6 |
Correct |
23 ms |
10448 KB |
Output is correct |
7 |
Correct |
38 ms |
9420 KB |
Output is correct |
8 |
Correct |
42 ms |
18124 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Runtime error |
340 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
16 ms |
6352 KB |
Output is correct |
4 |
Correct |
22 ms |
2776 KB |
Output is correct |
5 |
Correct |
36 ms |
6868 KB |
Output is correct |
6 |
Correct |
23 ms |
10448 KB |
Output is correct |
7 |
Correct |
38 ms |
9420 KB |
Output is correct |
8 |
Correct |
42 ms |
18124 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Runtime error |
340 ms |
524288 KB |
Execution killed with signal 9 |
12 |
Halted |
0 ms |
0 KB |
- |