답안 #27732

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
27732 2017-07-13T14:28:06 Z top34051 Brunhilda’s Birthday (BOI13_brunhilda) C++14
97.7778 / 100
419 ms 80536 KB
#include<bits/stdc++.h>
using namespace std;
#define inf (int)1e6
int n,m;
int p[100005];
int mx[10000005];
int mem[10000005];
main() {
    int i,j,x,val;
    scanf("%d%d",&n,&m);
    for(i=1;i<=n;i++) {
        scanf("%d",&val);
        x = 0;
        while(x<=10000000) {
            mx[x] = max(mx[x],val);
            x += val;
        }
    }
    for(i=0,j=1;i<=10000000;i++) for(j=max(j,i+1);j<i+mx[i];j++) mem[j] = mem[i]+1;
    while(m--) {
        scanf("%d",&x);
      	if(x==0) printf("%d",1/0);
        if(mem[x]==0) printf("oo\n");
        else printf("%d\n",mem[x]);
    }
}

Compilation message

brunhilda.cpp:8:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main() {
      ^
brunhilda.cpp: In function 'int main()':
brunhilda.cpp:22:30: warning: division by zero [-Wdiv-by-zero]
        if(x==0) printf("%d",1/0);
                              ^
brunhilda.cpp:10:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&n,&m);
                        ^
brunhilda.cpp:12:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&val);
                         ^
brunhilda.cpp:21:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&x);
                       ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 63 ms 80536 KB Output isn't correct
2 Correct 86 ms 80536 KB Output is correct
3 Correct 83 ms 80536 KB Output is correct
4 Correct 59 ms 80536 KB Output is correct
5 Correct 76 ms 80536 KB Output is correct
6 Incorrect 56 ms 80536 KB Output isn't correct
7 Correct 69 ms 80536 KB Output is correct
8 Correct 79 ms 80536 KB Output is correct
9 Correct 96 ms 80536 KB Output is correct
10 Correct 119 ms 80536 KB Output is correct
11 Correct 89 ms 80536 KB Output is correct
12 Correct 46 ms 80536 KB Output is correct
13 Correct 246 ms 80536 KB Output is correct
14 Correct 183 ms 80536 KB Output is correct
15 Correct 93 ms 80536 KB Output is correct
16 Correct 59 ms 80536 KB Output is correct
17 Correct 73 ms 80536 KB Output is correct
18 Correct 49 ms 80536 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 79 ms 80536 KB Output is correct
2 Correct 103 ms 80536 KB Output is correct
3 Correct 343 ms 80536 KB Output is correct
4 Correct 96 ms 80536 KB Output is correct
5 Correct 203 ms 80536 KB Output is correct
6 Correct 63 ms 80536 KB Output is correct
7 Correct 59 ms 80536 KB Output is correct
8 Correct 86 ms 80536 KB Output is correct
9 Correct 263 ms 80536 KB Output is correct
10 Correct 296 ms 80536 KB Output is correct
11 Correct 323 ms 80536 KB Output is correct
12 Correct 166 ms 80536 KB Output is correct
13 Correct 43 ms 80536 KB Output is correct
14 Correct 103 ms 80536 KB Output is correct
15 Correct 236 ms 80536 KB Output is correct
16 Correct 99 ms 80536 KB Output is correct
17 Correct 266 ms 80536 KB Output is correct
18 Correct 263 ms 80536 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 266 ms 80536 KB Output is correct
2 Correct 336 ms 80536 KB Output is correct
3 Correct 363 ms 80536 KB Output is correct
4 Correct 189 ms 80536 KB Output is correct
5 Correct 173 ms 80536 KB Output is correct
6 Correct 276 ms 80536 KB Output is correct
7 Correct 233 ms 80536 KB Output is correct
8 Correct 253 ms 80536 KB Output is correct
9 Correct 256 ms 80536 KB Output is correct
10 Correct 176 ms 80536 KB Output is correct
11 Correct 159 ms 80536 KB Output is correct
12 Correct 229 ms 80536 KB Output is correct
13 Correct 316 ms 80536 KB Output is correct
14 Correct 183 ms 80536 KB Output is correct
15 Correct 223 ms 80536 KB Output is correct
16 Correct 286 ms 80536 KB Output is correct
17 Correct 266 ms 80536 KB Output is correct
18 Correct 363 ms 80536 KB Output is correct
19 Correct 79 ms 80536 KB Output is correct
20 Correct 289 ms 80536 KB Output is correct
21 Correct 176 ms 80536 KB Output is correct
22 Correct 419 ms 80536 KB Output is correct
23 Correct 103 ms 80536 KB Output is correct
24 Correct 86 ms 80536 KB Output is correct
25 Correct 236 ms 80536 KB Output is correct
26 Correct 203 ms 80536 KB Output is correct
27 Correct 366 ms 80536 KB Output is correct
28 Correct 106 ms 80536 KB Output is correct
29 Correct 369 ms 80536 KB Output is correct
30 Correct 283 ms 80536 KB Output is correct
31 Correct 113 ms 80536 KB Output is correct
32 Correct 133 ms 80536 KB Output is correct
33 Correct 69 ms 80536 KB Output is correct
34 Correct 199 ms 80536 KB Output is correct
35 Correct 93 ms 80536 KB Output is correct
36 Correct 419 ms 80536 KB Output is correct
37 Correct 159 ms 80536 KB Output is correct
38 Correct 279 ms 80536 KB Output is correct
39 Correct 129 ms 80536 KB Output is correct
40 Correct 243 ms 80536 KB Output is correct
41 Correct 209 ms 80536 KB Output is correct
42 Correct 306 ms 80536 KB Output is correct