# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
31874 | 2017-09-11T08:23:10 Z | Dat160601 | Brunhilda’s Birthday (BOI13_brunhilda) | C++14 | 489 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--){ scanf("%d",&x); if(ans[x]==0) printf("oo\n"); else printf("%d\n",ans[x]-1); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 80532 KB | Output is correct |
2 | Correct | 96 ms | 80532 KB | Output is correct |
3 | Correct | 36 ms | 80532 KB | Output is correct |
4 | Correct | 63 ms | 80532 KB | Output is correct |
5 | Correct | 76 ms | 80532 KB | Output is correct |
6 | Correct | 16 ms | 80532 KB | Output is correct |
7 | Correct | 26 ms | 80532 KB | Output is correct |
8 | Correct | 59 ms | 80532 KB | Output is correct |
9 | Correct | 136 ms | 80532 KB | Output is correct |
10 | Correct | 139 ms | 80532 KB | Output is correct |
11 | Correct | 133 ms | 80532 KB | Output is correct |
12 | Correct | 59 ms | 80532 KB | Output is correct |
13 | Correct | 303 ms | 80532 KB | Output is correct |
14 | Correct | 286 ms | 80532 KB | Output is correct |
15 | Correct | 106 ms | 80532 KB | Output is correct |
16 | Correct | 83 ms | 80532 KB | Output is correct |
17 | Correct | 93 ms | 80532 KB | Output is correct |
18 | Correct | 39 ms | 80532 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 83 ms | 80532 KB | Output is correct |
2 | Correct | 103 ms | 80532 KB | Output is correct |
3 | Correct | 436 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 | 96 ms | 80532 KB | Output is correct |
7 | Correct | 83 ms | 80532 KB | Output is correct |
8 | Correct | 96 ms | 80532 KB | Output is correct |
9 | Correct | 316 ms | 80532 KB | Output is correct |
10 | Correct | 413 ms | 80532 KB | Output is correct |
11 | Correct | 389 ms | 80532 KB | Output is correct |
12 | Correct | 183 ms | 80532 KB | Output is correct |
13 | Correct | 69 ms | 80532 KB | Output is correct |
14 | Correct | 136 ms | 80532 KB | Output is correct |
15 | Correct | 309 ms | 80532 KB | Output is correct |
16 | Correct | 93 ms | 80532 KB | Output is correct |
17 | Correct | 323 ms | 80532 KB | Output is correct |
18 | Correct | 343 ms | 80532 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 333 ms | 80532 KB | Output is correct |
2 | Correct | 413 ms | 80532 KB | Output is correct |
3 | Correct | 453 ms | 80532 KB | Output is correct |
4 | Correct | 246 ms | 80532 KB | Output is correct |
5 | Correct | 136 ms | 80532 KB | Output is correct |
6 | Correct | 373 ms | 80532 KB | Output is correct |
7 | Correct | 329 ms | 80532 KB | Output is correct |
8 | Correct | 346 ms | 80532 KB | Output is correct |
9 | Correct | 269 ms | 80532 KB | Output is correct |
10 | Correct | 259 ms | 80532 KB | Output is correct |
11 | Correct | 196 ms | 80532 KB | Output is correct |
12 | Correct | 276 ms | 80532 KB | Output is correct |
13 | Correct | 413 ms | 80532 KB | Output is correct |
14 | Correct | 179 ms | 80532 KB | Output is correct |
15 | Correct | 269 ms | 80532 KB | Output is correct |
16 | Correct | 363 ms | 80532 KB | Output is correct |
17 | Correct | 326 ms | 80532 KB | Output is correct |
18 | Correct | 386 ms | 80532 KB | Output is correct |
19 | Correct | 86 ms | 80532 KB | Output is correct |
20 | Correct | 453 ms | 80532 KB | Output is correct |
21 | Correct | 243 ms | 80532 KB | Output is correct |
22 | Correct | 479 ms | 80532 KB | Output is correct |
23 | Correct | 149 ms | 80532 KB | Output is correct |
24 | Correct | 113 ms | 80532 KB | Output is correct |
25 | Correct | 263 ms | 80532 KB | Output is correct |
26 | Correct | 219 ms | 80532 KB | Output is correct |
27 | Correct | 489 ms | 80532 KB | Output is correct |
28 | Correct | 103 ms | 80532 KB | Output is correct |
29 | Correct | 436 ms | 80532 KB | Output is correct |
30 | Correct | 446 ms | 80532 KB | Output is correct |
31 | Correct | 143 ms | 80532 KB | Output is correct |
32 | Correct | 223 ms | 80532 KB | Output is correct |
33 | Correct | 96 ms | 80532 KB | Output is correct |
34 | Correct | 279 ms | 80532 KB | Output is correct |
35 | Correct | 116 ms | 80532 KB | Output is correct |
36 | Correct | 439 ms | 80532 KB | Output is correct |
37 | Correct | 179 ms | 80532 KB | Output is correct |
38 | Correct | 329 ms | 80532 KB | Output is correct |
39 | Correct | 119 ms | 80532 KB | Output is correct |
40 | Correct | 269 ms | 80532 KB | Output is correct |
41 | Correct | 213 ms | 80532 KB | Output is correct |
42 | Correct | 413 ms | 80532 KB | Output is correct |