Submission #27736

# Submission time Handle Problem Language Result Execution time Memory
27736 2017-07-13T14:41:55 Z top34051 Brunhilda’s Birthday (BOI13_brunhilda) C++14
100 / 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,ok;
    long long mul;
    scanf("%d%d",&n,&m);
    ok = 0; mul = 1;
    for(i=1;i<=n;i++) {
        scanf("%d",&val);
        x = 0;
        while(x<=10000000) {
            mx[x] = max(mx[x],val);
            x += val;
        }
        mul *= val;
        if(mul>=10000000) ok = 1;
    }
    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>=mul && !ok) 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:11: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:14: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 Correct 63 ms 80536 KB Output is correct
2 Correct 83 ms 80536 KB Output is correct
3 Correct 76 ms 80536 KB Output is correct
4 Correct 43 ms 80536 KB Output is correct
5 Correct 69 ms 80536 KB Output is correct
6 Correct 56 ms 80536 KB Output is correct
7 Correct 73 ms 80536 KB Output is correct
8 Correct 79 ms 80536 KB Output is correct
9 Correct 99 ms 80536 KB Output is correct
10 Correct 106 ms 80536 KB Output is correct
11 Correct 116 ms 80536 KB Output is correct
12 Correct 36 ms 80536 KB Output is correct
13 Correct 203 ms 80536 KB Output is correct
14 Correct 193 ms 80536 KB Output is correct
15 Correct 66 ms 80536 KB Output is correct
16 Correct 69 ms 80536 KB Output is correct
17 Correct 53 ms 80536 KB Output is correct
18 Correct 46 ms 80536 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 69 ms 80536 KB Output is correct
2 Correct 106 ms 80536 KB Output is correct
3 Correct 249 ms 80536 KB Output is correct
4 Correct 79 ms 80536 KB Output is correct
5 Correct 209 ms 80536 KB Output is correct
6 Correct 73 ms 80536 KB Output is correct
7 Correct 63 ms 80536 KB Output is correct
8 Correct 83 ms 80536 KB Output is correct
9 Correct 296 ms 80536 KB Output is correct
10 Correct 359 ms 80536 KB Output is correct
11 Correct 313 ms 80536 KB Output is correct
12 Correct 123 ms 80536 KB Output is correct
13 Correct 63 ms 80536 KB Output is correct
14 Correct 79 ms 80536 KB Output is correct
15 Correct 183 ms 80536 KB Output is correct
16 Correct 113 ms 80536 KB Output is correct
17 Correct 213 ms 80536 KB Output is correct
18 Correct 249 ms 80536 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 269 ms 80536 KB Output is correct
2 Correct 319 ms 80536 KB Output is correct
3 Correct 273 ms 80536 KB Output is correct
4 Correct 213 ms 80536 KB Output is correct
5 Correct 183 ms 80536 KB Output is correct
6 Correct 276 ms 80536 KB Output is correct
7 Correct 186 ms 80536 KB Output is correct
8 Correct 259 ms 80536 KB Output is correct
9 Correct 266 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 239 ms 80536 KB Output is correct
13 Correct 313 ms 80536 KB Output is correct
14 Correct 169 ms 80536 KB Output is correct
15 Correct 243 ms 80536 KB Output is correct
16 Correct 309 ms 80536 KB Output is correct
17 Correct 276 ms 80536 KB Output is correct
18 Correct 349 ms 80536 KB Output is correct
19 Correct 86 ms 80536 KB Output is correct
20 Correct 333 ms 80536 KB Output is correct
21 Correct 193 ms 80536 KB Output is correct
22 Correct 383 ms 80536 KB Output is correct
23 Correct 103 ms 80536 KB Output is correct
24 Correct 116 ms 80536 KB Output is correct
25 Correct 203 ms 80536 KB Output is correct
26 Correct 213 ms 80536 KB Output is correct
27 Correct 356 ms 80536 KB Output is correct
28 Correct 119 ms 80536 KB Output is correct
29 Correct 399 ms 80536 KB Output is correct
30 Correct 356 ms 80536 KB Output is correct
31 Correct 136 ms 80536 KB Output is correct
32 Correct 159 ms 80536 KB Output is correct
33 Correct 83 ms 80536 KB Output is correct
34 Correct 259 ms 80536 KB Output is correct
35 Correct 129 ms 80536 KB Output is correct
36 Correct 413 ms 80536 KB Output is correct
37 Correct 169 ms 80536 KB Output is correct
38 Correct 333 ms 80536 KB Output is correct
39 Correct 113 ms 80536 KB Output is correct
40 Correct 196 ms 80536 KB Output is correct
41 Correct 213 ms 80536 KB Output is correct
42 Correct 283 ms 80536 KB Output is correct