Submission #27730

# Submission time Handle Problem Language Result Execution time Memory
27730 2017-07-13T14:26:51 Z top34051 Brunhilda’s Birthday (BOI13_brunhilda) C++14
97.7778 / 100
389 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(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: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);
                       ^
# Verdict Execution time Memory Grader output
1 Incorrect 63 ms 80536 KB Output isn't correct
2 Correct 79 ms 80536 KB Output is correct
3 Correct 86 ms 80536 KB Output is correct
4 Correct 53 ms 80536 KB Output is correct
5 Correct 79 ms 80536 KB Output is correct
6 Incorrect 43 ms 80536 KB Output isn't correct
7 Correct 69 ms 80536 KB Output is correct
8 Correct 76 ms 80536 KB Output is correct
9 Correct 106 ms 80536 KB Output is correct
10 Correct 133 ms 80536 KB Output is correct
11 Correct 113 ms 80536 KB Output is correct
12 Correct 33 ms 80536 KB Output is correct
13 Correct 253 ms 80536 KB Output is correct
14 Correct 173 ms 80536 KB Output is correct
15 Correct 86 ms 80536 KB Output is correct
16 Correct 63 ms 80536 KB Output is correct
17 Correct 96 ms 80536 KB Output is correct
18 Correct 46 ms 80536 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 63 ms 80536 KB Output is correct
2 Correct 116 ms 80536 KB Output is correct
3 Correct 269 ms 80536 KB Output is correct
4 Correct 106 ms 80536 KB Output is correct
5 Correct 189 ms 80536 KB Output is correct
6 Correct 79 ms 80536 KB Output is correct
7 Correct 69 ms 80536 KB Output is correct
8 Correct 99 ms 80536 KB Output is correct
9 Correct 243 ms 80536 KB Output is correct
10 Correct 309 ms 80536 KB Output is correct
11 Correct 299 ms 80536 KB Output is correct
12 Correct 113 ms 80536 KB Output is correct
13 Correct 46 ms 80536 KB Output is correct
14 Correct 109 ms 80536 KB Output is correct
15 Correct 243 ms 80536 KB Output is correct
16 Correct 106 ms 80536 KB Output is correct
17 Correct 233 ms 80536 KB Output is correct
18 Correct 269 ms 80536 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 249 ms 80536 KB Output is correct
2 Correct 286 ms 80536 KB Output is correct
3 Correct 346 ms 80536 KB Output is correct
4 Correct 219 ms 80536 KB Output is correct
5 Correct 143 ms 80536 KB Output is correct
6 Correct 276 ms 80536 KB Output is correct
7 Correct 213 ms 80536 KB Output is correct
8 Correct 273 ms 80536 KB Output is correct
9 Correct 293 ms 80536 KB Output is correct
10 Correct 209 ms 80536 KB Output is correct
11 Correct 166 ms 80536 KB Output is correct
12 Correct 276 ms 80536 KB Output is correct
13 Correct 293 ms 80536 KB Output is correct
14 Correct 163 ms 80536 KB Output is correct
15 Correct 263 ms 80536 KB Output is correct
16 Correct 203 ms 80536 KB Output is correct
17 Correct 269 ms 80536 KB Output is correct
18 Correct 356 ms 80536 KB Output is correct
19 Correct 86 ms 80536 KB Output is correct
20 Correct 359 ms 80536 KB Output is correct
21 Correct 186 ms 80536 KB Output is correct
22 Correct 389 ms 80536 KB Output is correct
23 Correct 139 ms 80536 KB Output is correct
24 Correct 106 ms 80536 KB Output is correct
25 Correct 226 ms 80536 KB Output is correct
26 Correct 219 ms 80536 KB Output is correct
27 Correct 373 ms 80536 KB Output is correct
28 Correct 76 ms 80536 KB Output is correct
29 Correct 279 ms 80536 KB Output is correct
30 Correct 323 ms 80536 KB Output is correct
31 Correct 136 ms 80536 KB Output is correct
32 Correct 149 ms 80536 KB Output is correct
33 Correct 109 ms 80536 KB Output is correct
34 Correct 239 ms 80536 KB Output is correct
35 Correct 103 ms 80536 KB Output is correct
36 Correct 389 ms 80536 KB Output is correct
37 Correct 153 ms 80536 KB Output is correct
38 Correct 246 ms 80536 KB Output is correct
39 Correct 133 ms 80536 KB Output is correct
40 Correct 243 ms 80536 KB Output is correct
41 Correct 229 ms 80536 KB Output is correct
42 Correct 289 ms 80536 KB Output is correct