# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
783225 | 2023-07-14T18:23:42 Z | thimote75 | Intercastellar (JOI22_ho_t1) | C++14 | 368 ms | 9208 KB |
#include <bits/stdc++.h> #define int long long using namespace std; using idata = vector<int>; void cumul (idata &a) { for (int i = 1; i < a.size(); i ++) a[i] += a[i - 1]; } int bs (idata &arr, int t) { int a = -1; int b = arr.size(); while (b - a > 1) { int c = (a + b) >> 1; if (arr[c] >= t) b = c; else a = c; } return b; } signed main () { int N; cin >> N; idata sizes (N); idata values(N); for (int i = 0; i < N; i ++) { int x; cin >> x; int count = 1; while ((x & 1) == 0) { count *= 2; x >>= 1; } sizes [i] = count; values[i] = x; } cumul(sizes); int Q; cin >> Q; for (int i = 0; i < Q; i ++) { int x; cin >> x; int r = bs(sizes, x); cout << values[r] << "\n"; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 74 ms | 3944 KB | Output is correct |
4 | Correct | 203 ms | 2336 KB | Output is correct |
5 | Correct | 293 ms | 5712 KB | Output is correct |
6 | Correct | 147 ms | 4064 KB | Output is correct |
7 | Correct | 307 ms | 5452 KB | Output is correct |
8 | Correct | 290 ms | 5568 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 300 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 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 | 296 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 2 ms | 340 KB | Output is correct |
12 | Correct | 2 ms | 340 KB | Output is correct |
13 | Correct | 1 ms | 212 KB | Output is correct |
14 | Correct | 2 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 74 ms | 3944 KB | Output is correct |
4 | Correct | 203 ms | 2336 KB | Output is correct |
5 | Correct | 293 ms | 5712 KB | Output is correct |
6 | Correct | 147 ms | 4064 KB | Output is correct |
7 | Correct | 307 ms | 5452 KB | Output is correct |
8 | Correct | 290 ms | 5568 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 300 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 1 ms | 212 KB | Output is correct |
14 | Correct | 1 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 | 296 KB | Output is correct |
18 | Correct | 1 ms | 212 KB | Output is correct |
19 | Correct | 2 ms | 340 KB | Output is correct |
20 | Correct | 2 ms | 340 KB | Output is correct |
21 | Correct | 1 ms | 212 KB | Output is correct |
22 | Correct | 2 ms | 340 KB | Output is correct |
23 | Correct | 177 ms | 3000 KB | Output is correct |
24 | Correct | 152 ms | 5184 KB | Output is correct |
25 | Correct | 333 ms | 8860 KB | Output is correct |
26 | Correct | 202 ms | 5568 KB | Output is correct |
27 | Correct | 168 ms | 5516 KB | Output is correct |
28 | Correct | 363 ms | 9208 KB | Output is correct |
29 | Correct | 360 ms | 8656 KB | Output is correct |
30 | Correct | 243 ms | 3744 KB | Output is correct |
31 | Correct | 368 ms | 9136 KB | Output is correct |