# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
31868 | 2017-09-11T08:13:03 Z | YoLo | Brunhilda’s Birthday (BOI13_brunhilda) | C++14 | 613 ms | 158656 KB |
#include<bits/stdc++.h> using namespace std; int n, m, a[100009], j, num[20000009], nex, cur, t = 1, ans[20000009]; signed main() { scanf("%d%d",&n,&m); for(int i = 1; i <= n; i++) scanf("%d",&a[i]); for(int i = 1; i <= n; i++) { j = 0; while(j <= 10000000) { num[j] = max(num[j], j + a[i]); j += a[i]; } } num[1] = num[0]; ans[1] = 1; for(int i = 2; i <= 10000000; i++) { while(i >= num[cur] && cur < i) { cur ++; } if(cur == i) break; ans[i] = ans[cur] + 1; } while(m --) { int k; cin >> k; if(ans[k] > 0) printf("%d\n",ans[k]); else printf("oo\n"); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 23 ms | 158656 KB | Output is correct |
2 | Correct | 99 ms | 158656 KB | Output is correct |
3 | Correct | 43 ms | 158656 KB | Output is correct |
4 | Correct | 79 ms | 158656 KB | Output is correct |
5 | Correct | 79 ms | 158656 KB | Output is correct |
6 | Correct | 16 ms | 158656 KB | Output is correct |
7 | Correct | 36 ms | 158656 KB | Output is correct |
8 | Correct | 46 ms | 158656 KB | Output is correct |
9 | Correct | 116 ms | 158656 KB | Output is correct |
10 | Correct | 149 ms | 158656 KB | Output is correct |
11 | Correct | 133 ms | 158656 KB | Output is correct |
12 | Correct | 66 ms | 158656 KB | Output is correct |
13 | Correct | 256 ms | 158656 KB | Output is correct |
14 | Correct | 286 ms | 158656 KB | Output is correct |
15 | Correct | 89 ms | 158656 KB | Output is correct |
16 | Correct | 93 ms | 158656 KB | Output is correct |
17 | Correct | 156 ms | 158656 KB | Output is correct |
18 | Correct | 46 ms | 158656 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 79 ms | 158656 KB | Output is correct |
2 | Correct | 89 ms | 158656 KB | Output is correct |
3 | Correct | 406 ms | 158656 KB | Output is correct |
4 | Correct | 99 ms | 158656 KB | Output is correct |
5 | Correct | 236 ms | 158656 KB | Output is correct |
6 | Correct | 76 ms | 158656 KB | Output is correct |
7 | Correct | 69 ms | 158656 KB | Output is correct |
8 | Correct | 116 ms | 158656 KB | Output is correct |
9 | Correct | 323 ms | 158656 KB | Output is correct |
10 | Correct | 399 ms | 158656 KB | Output is correct |
11 | Correct | 393 ms | 158656 KB | Output is correct |
12 | Correct | 193 ms | 158656 KB | Output is correct |
13 | Correct | 63 ms | 158656 KB | Output is correct |
14 | Correct | 146 ms | 158656 KB | Output is correct |
15 | Correct | 329 ms | 158656 KB | Output is correct |
16 | Correct | 99 ms | 158656 KB | Output is correct |
17 | Correct | 313 ms | 158656 KB | Output is correct |
18 | Correct | 313 ms | 158656 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 426 ms | 158656 KB | Output is correct |
2 | Correct | 559 ms | 158656 KB | Output is correct |
3 | Correct | 526 ms | 158656 KB | Output is correct |
4 | Correct | 336 ms | 158656 KB | Output is correct |
5 | Runtime error | 286 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
6 | Correct | 433 ms | 158656 KB | Output is correct |
7 | Runtime error | 396 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
8 | Correct | 329 ms | 158656 KB | Output is correct |
9 | Correct | 336 ms | 158656 KB | Output is correct |
10 | Correct | 293 ms | 158656 KB | Output is correct |
11 | Correct | 283 ms | 158656 KB | Output is correct |
12 | Correct | 466 ms | 158656 KB | Output is correct |
13 | Runtime error | 486 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
14 | Runtime error | 356 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
15 | Correct | 303 ms | 158656 KB | Output is correct |
16 | Correct | 443 ms | 158656 KB | Output is correct |
17 | Correct | 353 ms | 158656 KB | Output is correct |
18 | Correct | 586 ms | 158656 KB | Output is correct |
19 | Correct | 213 ms | 158656 KB | Output is correct |
20 | Runtime error | 613 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
21 | Runtime error | 356 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
22 | Runtime error | 593 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
23 | Runtime error | 293 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
24 | Runtime error | 253 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
25 | Runtime error | 426 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
26 | Runtime error | 386 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
27 | Runtime error | 603 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
28 | Runtime error | 276 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
29 | Runtime error | 603 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
30 | Runtime error | 603 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
31 | Runtime error | 356 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
32 | Correct | 369 ms | 158656 KB | Output is correct |
33 | Correct | 203 ms | 158656 KB | Output is correct |
34 | Runtime error | 463 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
35 | Runtime error | 326 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
36 | Runtime error | 606 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
37 | Correct | 293 ms | 158656 KB | Output is correct |
38 | Runtime error | 496 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
39 | Correct | 276 ms | 158656 KB | Output is correct |
40 | Correct | 436 ms | 158656 KB | Output is correct |
41 | Correct | 326 ms | 158656 KB | Output is correct |
42 | Correct | 486 ms | 158656 KB | Output is correct |