# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
31864 | 2017-09-11T08:03:50 Z | YoLo | Brunhilda’s Birthday (BOI13_brunhilda) | C++14 | 689 ms | 158656 KB |
#include<bits/stdc++.h> using namespace std; #define mp make_pair #define pb push_back #define fi first #define se second #define endl '\n' #define pi acos(-1) #define pque priority_queue typedef pair < int, int > ii; typedef vector < int > vi; typedef vector < vi > vii; int mod = 1000000007; 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",ans[k]); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 33 ms | 158656 KB | Output is correct |
2 | Correct | 109 ms | 158656 KB | Output is correct |
3 | Correct | 29 ms | 158656 KB | Output is correct |
4 | Correct | 83 ms | 158656 KB | Output is correct |
5 | Correct | 83 ms | 158656 KB | Output is correct |
6 | Correct | 19 ms | 158656 KB | Output is correct |
7 | Correct | 43 ms | 158656 KB | Output is correct |
8 | Correct | 39 ms | 158656 KB | Output is correct |
9 | Correct | 119 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 | 53 ms | 158656 KB | Output is correct |
13 | Correct | 279 ms | 158656 KB | Output is correct |
14 | Correct | 359 ms | 158656 KB | Output is correct |
15 | Correct | 113 ms | 158656 KB | Output is correct |
16 | Correct | 93 ms | 158656 KB | Output is correct |
17 | Correct | 119 ms | 158656 KB | Output is correct |
18 | Correct | 69 ms | 158656 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 86 ms | 158656 KB | Output is correct |
2 | Correct | 103 ms | 158656 KB | Output is correct |
3 | Correct | 363 ms | 158656 KB | Output is correct |
4 | Correct | 113 ms | 158656 KB | Output is correct |
5 | Correct | 249 ms | 158656 KB | Output is correct |
6 | Correct | 83 ms | 158656 KB | Output is correct |
7 | Correct | 83 ms | 158656 KB | Output is correct |
8 | Correct | 123 ms | 158656 KB | Output is correct |
9 | Correct | 296 ms | 158656 KB | Output is correct |
10 | Correct | 343 ms | 158656 KB | Output is correct |
11 | Correct | 339 ms | 158656 KB | Output is correct |
12 | Correct | 173 ms | 158656 KB | Output is correct |
13 | Correct | 53 ms | 158656 KB | Output is correct |
14 | Correct | 109 ms | 158656 KB | Output is correct |
15 | Correct | 306 ms | 158656 KB | Output is correct |
16 | Correct | 86 ms | 158656 KB | Output is correct |
17 | Correct | 286 ms | 158656 KB | Output is correct |
18 | Correct | 243 ms | 158656 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 469 ms | 158656 KB | Output is correct |
2 | Correct | 419 ms | 158656 KB | Output is correct |
3 | Runtime error | 549 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
4 | Runtime error | 363 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
5 | Runtime error | 326 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
6 | Runtime error | 443 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
7 | Correct | 353 ms | 158656 KB | Output is correct |
8 | Correct | 323 ms | 158656 KB | Output is correct |
9 | Runtime error | 503 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
10 | Correct | 249 ms | 158656 KB | Output is correct |
11 | Correct | 323 ms | 158656 KB | Output is correct |
12 | Correct | 326 ms | 158656 KB | Output is correct |
13 | Runtime error | 533 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
14 | Runtime error | 303 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
15 | Correct | 283 ms | 158656 KB | Output is correct |
16 | Correct | 446 ms | 158656 KB | Output is correct |
17 | Correct | 319 ms | 158656 KB | Output is correct |
18 | Correct | 403 ms | 158656 KB | Output is correct |
19 | Correct | 159 ms | 158656 KB | Output is correct |
20 | Correct | 589 ms | 158656 KB | Output is correct |
21 | Runtime error | 403 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
22 | Runtime error | 573 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
23 | Correct | 296 ms | 158656 KB | Output is correct |
24 | Correct | 279 ms | 158656 KB | Output is correct |
25 | Correct | 379 ms | 158656 KB | Output is correct |
26 | Runtime error | 339 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
27 | Runtime error | 689 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
28 | Runtime error | 229 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
29 | Runtime error | 539 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
30 | Runtime error | 523 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
31 | Correct | 276 ms | 158656 KB | Output is correct |
32 | Runtime error | 329 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
33 | Runtime error | 143 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
34 | Correct | 426 ms | 158656 KB | Output is correct |
35 | Runtime error | 253 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
36 | Runtime error | 599 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
37 | Runtime error | 253 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
38 | Runtime error | 489 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
39 | Runtime error | 196 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |
40 | Correct | 469 ms | 158656 KB | Output is correct |
41 | Correct | 276 ms | 158656 KB | Output is correct |
42 | Runtime error | 559 ms | 158656 KB | Execution timed out (wall clock limit exceeded) |