# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
31883 | 2017-09-11T08:55:12 Z | Kanvie | Brunhilda’s Birthday (BOI13_brunhilda) | C++14 | 479 ms | 79628 KB |
#include<stdio.h> #include<algorithm> using namespace std; const int M=10000000; int x,m,q,d[M+5],a[100001],b[M+5],p,pp,cnt; int main() { scanf("%d%d",&m,&q); for(int i=1;i<=m;++i)scanf("%d",&a[i]); for(int i=1;i<=m;++i) for(int j=0;j<=M;j+=a[i])d[j]=max(d[j],a[i]); for(int i=0;i<=M;++i) { while(i<=p&&i<=M) { if(d[i]!=0)pp=max(pp,i+d[i]-1); b[i]=cnt; if(i==p)break; i++; } if(i==pp)break; p=pp; ++cnt; } while(q--) { scanf("%d",&x); if(b[x]==0&&x!=0)printf("oo\n"); else printf("%d\n",b[x]); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 79628 KB | Output is correct |
2 | Correct | 86 ms | 79628 KB | Output is correct |
3 | Correct | 33 ms | 79628 KB | Output is correct |
4 | Correct | 49 ms | 79628 KB | Output is correct |
5 | Correct | 76 ms | 79628 KB | Output is correct |
6 | Correct | 16 ms | 79628 KB | Output is correct |
7 | Correct | 46 ms | 79628 KB | Output is correct |
8 | Correct | 49 ms | 79628 KB | Output is correct |
9 | Correct | 109 ms | 79628 KB | Output is correct |
10 | Correct | 143 ms | 79628 KB | Output is correct |
11 | Correct | 129 ms | 79628 KB | Output is correct |
12 | Correct | 46 ms | 79628 KB | Output is correct |
13 | Correct | 253 ms | 79628 KB | Output is correct |
14 | Correct | 223 ms | 79628 KB | Output is correct |
15 | Correct | 86 ms | 79628 KB | Output is correct |
16 | Correct | 79 ms | 79628 KB | Output is correct |
17 | Correct | 103 ms | 79628 KB | Output is correct |
18 | Correct | 39 ms | 79628 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 66 ms | 79628 KB | Output is correct |
2 | Correct | 99 ms | 79628 KB | Output is correct |
3 | Correct | 303 ms | 79628 KB | Output is correct |
4 | Correct | 143 ms | 79628 KB | Output is correct |
5 | Correct | 196 ms | 79628 KB | Output is correct |
6 | Correct | 79 ms | 79628 KB | Output is correct |
7 | Correct | 69 ms | 79628 KB | Output is correct |
8 | Correct | 133 ms | 79628 KB | Output is correct |
9 | Correct | 296 ms | 79628 KB | Output is correct |
10 | Correct | 359 ms | 79628 KB | Output is correct |
11 | Correct | 329 ms | 79628 KB | Output is correct |
12 | Correct | 166 ms | 79628 KB | Output is correct |
13 | Correct | 53 ms | 79628 KB | Output is correct |
14 | Correct | 156 ms | 79628 KB | Output is correct |
15 | Correct | 273 ms | 79628 KB | Output is correct |
16 | Correct | 109 ms | 79628 KB | Output is correct |
17 | Correct | 279 ms | 79628 KB | Output is correct |
18 | Correct | 299 ms | 79628 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 273 ms | 79628 KB | Output is correct |
2 | Correct | 386 ms | 79628 KB | Output is correct |
3 | Correct | 416 ms | 79628 KB | Output is correct |
4 | Correct | 243 ms | 79628 KB | Output is correct |
5 | Correct | 173 ms | 79628 KB | Output is correct |
6 | Correct | 306 ms | 79628 KB | Output is correct |
7 | Correct | 263 ms | 79628 KB | Output is correct |
8 | Correct | 269 ms | 79628 KB | Output is correct |
9 | Correct | 286 ms | 79628 KB | Output is correct |
10 | Correct | 253 ms | 79628 KB | Output is correct |
11 | Correct | 213 ms | 79628 KB | Output is correct |
12 | Correct | 259 ms | 79628 KB | Output is correct |
13 | Correct | 333 ms | 79628 KB | Output is correct |
14 | Correct | 173 ms | 79628 KB | Output is correct |
15 | Correct | 273 ms | 79628 KB | Output is correct |
16 | Correct | 313 ms | 79628 KB | Output is correct |
17 | Correct | 273 ms | 79628 KB | Output is correct |
18 | Correct | 346 ms | 79628 KB | Output is correct |
19 | Correct | 96 ms | 79628 KB | Output is correct |
20 | Correct | 343 ms | 79628 KB | Output is correct |
21 | Correct | 206 ms | 79628 KB | Output is correct |
22 | Correct | 396 ms | 79628 KB | Output is correct |
23 | Correct | 183 ms | 79628 KB | Output is correct |
24 | Correct | 133 ms | 79628 KB | Output is correct |
25 | Correct | 286 ms | 79628 KB | Output is correct |
26 | Correct | 259 ms | 79628 KB | Output is correct |
27 | Correct | 479 ms | 79628 KB | Output is correct |
28 | Correct | 123 ms | 79628 KB | Output is correct |
29 | Correct | 393 ms | 79628 KB | Output is correct |
30 | Correct | 329 ms | 79628 KB | Output is correct |
31 | Correct | 169 ms | 79628 KB | Output is correct |
32 | Correct | 223 ms | 79628 KB | Output is correct |
33 | Correct | 103 ms | 79628 KB | Output is correct |
34 | Correct | 286 ms | 79628 KB | Output is correct |
35 | Correct | 143 ms | 79628 KB | Output is correct |
36 | Correct | 386 ms | 79628 KB | Output is correct |
37 | Correct | 189 ms | 79628 KB | Output is correct |
38 | Correct | 323 ms | 79628 KB | Output is correct |
39 | Correct | 153 ms | 79628 KB | Output is correct |
40 | Correct | 279 ms | 79628 KB | Output is correct |
41 | Correct | 256 ms | 79628 KB | Output is correct |
42 | Correct | 333 ms | 79628 KB | Output is correct |