Submission #27734

# Submission time Handle Problem Language Result Execution time Memory
27734 2017-07-13T14:32:14 Z top34051 Brunhilda’s Birthday (BOI13_brunhilda) C++14
97.7778 / 100
413 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);
    memset(mx,-1,sizeof(mx));
    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++) {
        if(mx[i]==-1) continue;
        for(j=max(j,i+1);j<i+mx[i];j++) mem[j] = mem[i]+1;
    }
    while(m--) {
        scanf("%d",&x);
        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: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:13:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&val);
                         ^
brunhilda.cpp:25:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&x);
                       ^
# Verdict Execution time Memory Grader output
1 Incorrect 63 ms 80536 KB Output isn't correct
2 Correct 99 ms 80536 KB Output is correct
3 Correct 89 ms 80536 KB Output is correct
4 Correct 73 ms 80536 KB Output is correct
5 Correct 86 ms 80536 KB Output is correct
6 Incorrect 63 ms 80536 KB Output isn't correct
7 Correct 83 ms 80536 KB Output is correct
8 Correct 93 ms 80536 KB Output is correct
9 Correct 119 ms 80536 KB Output is correct
10 Correct 129 ms 80536 KB Output is correct
11 Correct 149 ms 80536 KB Output is correct
12 Correct 53 ms 80536 KB Output is correct
13 Correct 209 ms 80536 KB Output is correct
14 Correct 269 ms 80536 KB Output is correct
15 Correct 129 ms 80536 KB Output is correct
16 Correct 103 ms 80536 KB Output is correct
17 Correct 89 ms 80536 KB Output is correct
18 Correct 56 ms 80536 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 93 ms 80536 KB Output is correct
2 Correct 116 ms 80536 KB Output is correct
3 Correct 349 ms 80536 KB Output is correct
4 Correct 149 ms 80536 KB Output is correct
5 Correct 269 ms 80536 KB Output is correct
6 Correct 89 ms 80536 KB Output is correct
7 Correct 99 ms 80536 KB Output is correct
8 Correct 146 ms 80536 KB Output is correct
9 Correct 296 ms 80536 KB Output is correct
10 Correct 366 ms 80536 KB Output is correct
11 Correct 353 ms 80536 KB Output is correct
12 Correct 189 ms 80536 KB Output is correct
13 Correct 89 ms 80536 KB Output is correct
14 Correct 176 ms 80536 KB Output is correct
15 Correct 276 ms 80536 KB Output is correct
16 Correct 133 ms 80536 KB Output is correct
17 Correct 293 ms 80536 KB Output is correct
18 Correct 296 ms 80536 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 279 ms 80536 KB Output is correct
2 Correct 319 ms 80536 KB Output is correct
3 Correct 283 ms 80536 KB Output is correct
4 Correct 183 ms 80536 KB Output is correct
5 Correct 199 ms 80536 KB Output is correct
6 Correct 306 ms 80536 KB Output is correct
7 Correct 306 ms 80536 KB Output is correct
8 Correct 279 ms 80536 KB Output is correct
9 Correct 283 ms 80536 KB Output is correct
10 Correct 253 ms 80536 KB Output is correct
11 Correct 209 ms 80536 KB Output is correct
12 Correct 273 ms 80536 KB Output is correct
13 Correct 369 ms 80536 KB Output is correct
14 Correct 183 ms 80536 KB Output is correct
15 Correct 249 ms 80536 KB Output is correct
16 Correct 319 ms 80536 KB Output is correct
17 Correct 276 ms 80536 KB Output is correct
18 Correct 356 ms 80536 KB Output is correct
19 Correct 99 ms 80536 KB Output is correct
20 Correct 359 ms 80536 KB Output is correct
21 Correct 173 ms 80536 KB Output is correct
22 Correct 293 ms 80536 KB Output is correct
23 Correct 179 ms 80536 KB Output is correct
24 Correct 163 ms 80536 KB Output is correct
25 Correct 289 ms 80536 KB Output is correct
26 Correct 243 ms 80536 KB Output is correct
27 Correct 409 ms 80536 KB Output is correct
28 Correct 129 ms 80536 KB Output is correct
29 Correct 413 ms 80536 KB Output is correct
30 Correct 363 ms 80536 KB Output is correct
31 Correct 156 ms 80536 KB Output is correct
32 Correct 156 ms 80536 KB Output is correct
33 Correct 116 ms 80536 KB Output is correct
34 Correct 323 ms 80536 KB Output is correct
35 Correct 149 ms 80536 KB Output is correct
36 Correct 389 ms 80536 KB Output is correct
37 Correct 186 ms 80536 KB Output is correct
38 Correct 236 ms 80536 KB Output is correct
39 Correct 156 ms 80536 KB Output is correct
40 Correct 276 ms 80536 KB Output is correct
41 Correct 249 ms 80536 KB Output is correct
42 Correct 329 ms 80536 KB Output is correct