#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pll;
#define fastio ios::sync_with_stdio(false), cin.tie(0)
#pragma GCC optimize("Ofast")
#define pb push_back
#define eb emplace_back
#define f first
#define s second
#define lowbit(x) x&-x
const int maxn = 2e5 + 5;
const int INF = 1e9;
int main(void){
fastio;
int n;
cin>>n;
vector<ll> a(n), cnt(n);
for(int i = 0; i < n; i++){
cin>>a[i];
cnt[i] = 1;
while(a[i] % 2 == 0) a[i] /= 2, cnt[i] *= 2;
}
for(int i = 1; i < n; i++) cnt[i] += cnt[i - 1];
int q;
cin>>q;
int cur = 0;
for(int i = 0; i < q; i++){
ll x;
cin>>x;
while(cnt[cur] < x) cur++;
cout<<a[cur]<<"\n";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
16 ms |
3480 KB |
Output is correct |
4 |
Correct |
21 ms |
1372 KB |
Output is correct |
5 |
Correct |
45 ms |
3968 KB |
Output is correct |
6 |
Correct |
22 ms |
3160 KB |
Output is correct |
7 |
Correct |
37 ms |
3852 KB |
Output is correct |
8 |
Correct |
35 ms |
3860 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
492 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
464 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
16 ms |
3480 KB |
Output is correct |
4 |
Correct |
21 ms |
1372 KB |
Output is correct |
5 |
Correct |
45 ms |
3968 KB |
Output is correct |
6 |
Correct |
22 ms |
3160 KB |
Output is correct |
7 |
Correct |
37 ms |
3852 KB |
Output is correct |
8 |
Correct |
35 ms |
3860 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
492 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
464 KB |
Output is correct |
23 |
Correct |
21 ms |
2880 KB |
Output is correct |
24 |
Correct |
26 ms |
4696 KB |
Output is correct |
25 |
Correct |
49 ms |
7508 KB |
Output is correct |
26 |
Correct |
35 ms |
4660 KB |
Output is correct |
27 |
Correct |
38 ms |
4584 KB |
Output is correct |
28 |
Correct |
58 ms |
7216 KB |
Output is correct |
29 |
Correct |
54 ms |
6736 KB |
Output is correct |
30 |
Correct |
29 ms |
3020 KB |
Output is correct |
31 |
Correct |
62 ms |
6964 KB |
Output is correct |