#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<int> 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";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
17 ms |
2500 KB |
Output is correct |
4 |
Correct |
23 ms |
1988 KB |
Output is correct |
5 |
Correct |
38 ms |
3420 KB |
Output is correct |
6 |
Correct |
24 ms |
2644 KB |
Output is correct |
7 |
Correct |
39 ms |
3272 KB |
Output is correct |
8 |
Correct |
36 ms |
3656 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
604 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Runtime error |
1 ms |
600 KB |
Execution killed with signal 11 |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
17 ms |
2500 KB |
Output is correct |
4 |
Correct |
23 ms |
1988 KB |
Output is correct |
5 |
Correct |
38 ms |
3420 KB |
Output is correct |
6 |
Correct |
24 ms |
2644 KB |
Output is correct |
7 |
Correct |
39 ms |
3272 KB |
Output is correct |
8 |
Correct |
36 ms |
3656 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
604 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
344 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Runtime error |
1 ms |
600 KB |
Execution killed with signal 11 |
18 |
Halted |
0 ms |
0 KB |
- |