#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <utility>
#include <bitset>
#include <climits>
#include <set>
#include <map>
#include <iomanip>
#include <queue>
#include <cstring>
#include <fstream>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define pll pair<ll, ll>
#define pii pair<int, int>
#define f first
#define s second
#define inf 1000000000000000
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
ll n;
cin >> n;
ll a,cnt=0, arr[n];
vector<ll> v;
for(int i=0;i<n;i++){
cin >> arr[i];
cnt+=arr[i]&-arr[i];
arr[i]/=arr[i]&-arr[i];
v.pb(cnt);
}
ll q;
cin >> q;
while(q--){
cin >> a;
cout << arr[lower_bound(v.begin(), v.end(), a)-v.begin()] << endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
60 ms |
3940 KB |
Output is correct |
4 |
Correct |
193 ms |
1380 KB |
Output is correct |
5 |
Correct |
283 ms |
4036 KB |
Output is correct |
6 |
Correct |
138 ms |
3792 KB |
Output is correct |
7 |
Correct |
263 ms |
3988 KB |
Output is correct |
8 |
Correct |
278 ms |
4016 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
2 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
2 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
3 ms |
340 KB |
Output is correct |
12 |
Correct |
3 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
2 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
60 ms |
3940 KB |
Output is correct |
4 |
Correct |
193 ms |
1380 KB |
Output is correct |
5 |
Correct |
283 ms |
4036 KB |
Output is correct |
6 |
Correct |
138 ms |
3792 KB |
Output is correct |
7 |
Correct |
263 ms |
3988 KB |
Output is correct |
8 |
Correct |
278 ms |
4016 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
2 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
2 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
3 ms |
340 KB |
Output is correct |
20 |
Correct |
3 ms |
340 KB |
Output is correct |
21 |
Correct |
1 ms |
340 KB |
Output is correct |
22 |
Correct |
2 ms |
340 KB |
Output is correct |
23 |
Correct |
158 ms |
2020 KB |
Output is correct |
24 |
Correct |
128 ms |
3536 KB |
Output is correct |
25 |
Correct |
292 ms |
5612 KB |
Output is correct |
26 |
Correct |
158 ms |
3008 KB |
Output is correct |
27 |
Correct |
130 ms |
3536 KB |
Output is correct |
28 |
Correct |
300 ms |
4916 KB |
Output is correct |
29 |
Correct |
308 ms |
4040 KB |
Output is correct |
30 |
Correct |
209 ms |
1532 KB |
Output is correct |
31 |
Correct |
293 ms |
4360 KB |
Output is correct |