# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
31869 | 2017-09-11T08:16:47 Z | Dat160601 | Brunhilda’s Birthday (BOI13_brunhilda) | C++14 | 679 ms | 80532 KB |
#include <bits/stdc++.h> const int MAX=1e7; using namespace std; int m,q,ans[MAX+7],pr[100007],dive[MAX+7],x; void prep(){ for(int i=1;i<=m;i++){ for(int j=0;j<=MAX;j+=pr[i]){ dive[j]=pr[i]; } } } int main(){ scanf("%d %d",&m,&q); for(int i=1;i<=m;i++){ scanf("%d",&pr[i]); } prep(); int cnt=0; ans[0]=1; for(int i=1;i<=MAX;i++){ while(cnt<i && cnt+dive[cnt]-1<i) cnt++; if(cnt==i) break; ans[i]=ans[cnt]+1; } while(q--){ cin>>x; if(ans[x]==0) printf("oo"); else printf("%d",ans[x]-1); printf("\n"); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 26 ms | 80532 KB | Output is correct |
2 | Correct | 99 ms | 80532 KB | Output is correct |
3 | Correct | 39 ms | 80532 KB | Output is correct |
4 | Correct | 136 ms | 80532 KB | Output is correct |
5 | Correct | 69 ms | 80532 KB | Output is correct |
6 | Correct | 19 ms | 80532 KB | Output is correct |
7 | Correct | 29 ms | 80532 KB | Output is correct |
8 | Correct | 49 ms | 80532 KB | Output is correct |
9 | Correct | 116 ms | 80532 KB | Output is correct |
10 | Correct | 129 ms | 80532 KB | Output is correct |
11 | Correct | 123 ms | 80532 KB | Output is correct |
12 | Correct | 56 ms | 80532 KB | Output is correct |
13 | Correct | 283 ms | 80532 KB | Output is correct |
14 | Correct | 286 ms | 80532 KB | Output is correct |
15 | Correct | 96 ms | 80532 KB | Output is correct |
16 | Correct | 96 ms | 80532 KB | Output is correct |
17 | Correct | 123 ms | 80532 KB | Output is correct |
18 | Correct | 96 ms | 80532 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 103 ms | 80532 KB | Output is correct |
2 | Correct | 109 ms | 80532 KB | Output is correct |
3 | Correct | 419 ms | 80532 KB | Output is correct |
4 | Correct | 123 ms | 80532 KB | Output is correct |
5 | Correct | 243 ms | 80532 KB | Output is correct |
6 | Correct | 63 ms | 80532 KB | Output is correct |
7 | Correct | 66 ms | 80532 KB | Output is correct |
8 | Correct | 103 ms | 80532 KB | Output is correct |
9 | Correct | 319 ms | 80532 KB | Output is correct |
10 | Correct | 409 ms | 80532 KB | Output is correct |
11 | Correct | 393 ms | 80532 KB | Output is correct |
12 | Correct | 179 ms | 80532 KB | Output is correct |
13 | Correct | 69 ms | 80532 KB | Output is correct |
14 | Correct | 119 ms | 80532 KB | Output is correct |
15 | Correct | 333 ms | 80532 KB | Output is correct |
16 | Correct | 89 ms | 80532 KB | Output is correct |
17 | Correct | 306 ms | 80532 KB | Output is correct |
18 | Correct | 299 ms | 80532 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 576 ms | 80532 KB | Execution timed out (wall clock limit exceeded) |
2 | Correct | 569 ms | 80532 KB | Output is correct |
3 | Runtime error | 643 ms | 80532 KB | Execution timed out (wall clock limit exceeded) |
4 | Runtime error | 393 ms | 80532 KB | Execution timed out (wall clock limit exceeded) |
5 | Runtime error | 329 ms | 80532 KB | Execution timed out (wall clock limit exceeded) |
6 | Runtime error | 489 ms | 80532 KB | Execution timed out (wall clock limit exceeded) |
7 | Correct | 496 ms | 80532 KB | Output is correct |
8 | Runtime error | 469 ms | 80532 KB | Execution timed out (wall clock limit exceeded) |
9 | Correct | 566 ms | 80532 KB | Output is correct |
10 | Correct | 226 ms | 80532 KB | Output is correct |
11 | Correct | 279 ms | 80532 KB | Output is correct |
12 | Correct | 393 ms | 80532 KB | Output is correct |
13 | Runtime error | 603 ms | 80532 KB | Execution timed out (wall clock limit exceeded) |
14 | Runtime error | 386 ms | 80532 KB | Execution timed out (wall clock limit exceeded) |
15 | Correct | 469 ms | 80532 KB | Output is correct |
16 | Correct | 483 ms | 80532 KB | Output is correct |
17 | Correct | 389 ms | 80532 KB | Output is correct |
18 | Correct | 603 ms | 80532 KB | Output is correct |
19 | Correct | 139 ms | 80532 KB | Output is correct |
20 | Runtime error | 539 ms | 80532 KB | Execution timed out (wall clock limit exceeded) |
21 | Runtime error | 389 ms | 80532 KB | Execution timed out (wall clock limit exceeded) |
22 | Runtime error | 679 ms | 80532 KB | Execution timed out (wall clock limit exceeded) |
23 | Correct | 316 ms | 80532 KB | Output is correct |
24 | Runtime error | 256 ms | 80532 KB | Execution timed out (wall clock limit exceeded) |
25 | Runtime error | 456 ms | 80532 KB | Execution timed out (wall clock limit exceeded) |
26 | Runtime error | 386 ms | 80532 KB | Execution timed out (wall clock limit exceeded) |
27 | Runtime error | 636 ms | 80532 KB | Execution timed out (wall clock limit exceeded) |
28 | Runtime error | 216 ms | 80532 KB | Execution timed out (wall clock limit exceeded) |
29 | Runtime error | 669 ms | 80532 KB | Execution timed out (wall clock limit exceeded) |
30 | Runtime error | 549 ms | 80532 KB | Execution timed out (wall clock limit exceeded) |
31 | Runtime error | 289 ms | 80532 KB | Execution timed out (wall clock limit exceeded) |
32 | Runtime error | 299 ms | 80532 KB | Execution timed out (wall clock limit exceeded) |
33 | Runtime error | 253 ms | 80532 KB | Execution timed out (wall clock limit exceeded) |
34 | Runtime error | 453 ms | 80532 KB | Execution timed out (wall clock limit exceeded) |
35 | Runtime error | 326 ms | 80532 KB | Execution timed out (wall clock limit exceeded) |
36 | Runtime error | 543 ms | 80532 KB | Execution timed out (wall clock limit exceeded) |
37 | Runtime error | 276 ms | 80532 KB | Execution timed out (wall clock limit exceeded) |
38 | Runtime error | 523 ms | 80532 KB | Execution timed out (wall clock limit exceeded) |
39 | Correct | 236 ms | 80532 KB | Output is correct |
40 | Correct | 423 ms | 80532 KB | Output is correct |
41 | Correct | 346 ms | 80532 KB | Output is correct |
42 | Correct | 549 ms | 80532 KB | Output is correct |