#include <bits/stdc++.h>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define pii pair<int,int>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define STL(i, x) for(auto &i:x) cout << i << " "; cout << "\n";
using namespace std;
int a[200050], b[200050];
int qx[200050];
void db(){
cout << "\n";
}
template<class T, class ...U>
void db(T XXX, U ...YYY){
cout << XXX; db(YYY...);
}
int main(){
int n, q;
cin >> n;
loop(i,0,n){
cin >> a[i];
b[i] = a[i];
}
cin >> q;
//db("q = ", q);
loop(i,0,q){
cin >> qx[i];
}
int now_i = 0;
long long sum = 0, cnt;
loop(i,0,n){
cnt = 1;
while(!(b[i] & 1)){
b[i] >>= 1;
cnt <<= 1;
}
sum += cnt;
while(true){
if(now_i == q)
return 0;
if(qx[now_i] <= sum){
cout << b[i] << "\n";
now_i++;
}
else break;
}
}
}
/*
4
14 9 8 12
6
2 3 5 7 11 13
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1074 ms |
212 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1069 ms |
212 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1074 ms |
212 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1069 ms |
212 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1074 ms |
212 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |