#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#define ll long long
using namespace std;
map <ll, ll> mp;
ll n, q, k, f, s, A[200000];
int main() {
cin >> n;
for (int i=0; i<n; ++i) {
cin >> A[i];
k = 1;
while (!(A[i] & 1)) {
A[i] /= 2;
k *= 2;
}
s += k;
mp[s] = A[i];
}
cin >> q;
while (q--) {
cin >> k;
cout << mp.lower_bound(k)->second << '\n';
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
108 ms |
14272 KB |
Output is correct |
4 |
Correct |
226 ms |
4964 KB |
Output is correct |
5 |
Correct |
367 ms |
16740 KB |
Output is correct |
6 |
Correct |
190 ms |
13296 KB |
Output is correct |
7 |
Correct |
387 ms |
16692 KB |
Output is correct |
8 |
Correct |
366 ms |
16560 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 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
2 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
2 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
2 ms |
348 KB |
Output is correct |
12 |
Correct |
2 ms |
440 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
3 ms |
348 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 |
108 ms |
14272 KB |
Output is correct |
4 |
Correct |
226 ms |
4964 KB |
Output is correct |
5 |
Correct |
367 ms |
16740 KB |
Output is correct |
6 |
Correct |
190 ms |
13296 KB |
Output is correct |
7 |
Correct |
387 ms |
16692 KB |
Output is correct |
8 |
Correct |
366 ms |
16560 KB |
Output is correct |
9 |
Correct |
1 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 |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
2 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
2 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
2 ms |
348 KB |
Output is correct |
20 |
Correct |
2 ms |
440 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
3 ms |
348 KB |
Output is correct |
23 |
Correct |
197 ms |
4812 KB |
Output is correct |
24 |
Correct |
197 ms |
12936 KB |
Output is correct |
25 |
Correct |
403 ms |
19796 KB |
Output is correct |
26 |
Correct |
243 ms |
12840 KB |
Output is correct |
27 |
Correct |
214 ms |
13436 KB |
Output is correct |
28 |
Correct |
435 ms |
20528 KB |
Output is correct |
29 |
Correct |
431 ms |
19540 KB |
Output is correct |
30 |
Correct |
287 ms |
5036 KB |
Output is correct |
31 |
Correct |
464 ms |
20052 KB |
Output is correct |