Submission #209934

# Submission time Handle Problem Language Result Execution time Memory
209934 2020-03-16T02:26:30 Z dantoh000 Brunhilda’s Birthday (BOI13_brunhilda) C++14
0 / 100
19 ms 1276 KB
#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000007;
const int MAXN = 10;
int a[MAXN];
int ans[MAXN];
int main(){
    int n,q;
    scanf("%d%d",&n,&q);
    for (int i = 0; i < n; i++){
        int k;
        scanf("%d",&k);
        for (int j = k-1; j < MAXN; j+=k){
            a[j] = k-1;
        }
    }
    for (int i = MAXN-2; i >= 0; i--){
        a[i] = max(a[i],a[i+1]-1);
    }
    fill(ans,ans+MAXN,INF);
    ans[1] = 1;
    ans[0] = 0;
    for (int i = 2; i < MAXN; i++){
        if (a[i] == 0) ans[i] = INF;
        else ans[i] = min(ans[i],ans[i-a[i]]+1);
    }
    for (int i = 0; i < q; i++){
        int x;
        scanf("%d",&x);
        if (ans[x] == INF) printf("oo\n");
        else printf("%d\n",ans[x]);
    }
}

Compilation message

brunhilda.cpp: In function 'int main()':
brunhilda.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&n,&q);
     ~~~~~^~~~~~~~~~~~~~
brunhilda.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&k);
         ~~~~~^~~~~~~~~
brunhilda.cpp:29:14: 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 Runtime error 5 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 5 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 5 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 6 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Incorrect 5 ms 256 KB Output isn't correct
6 Runtime error 5 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 5 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 5 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Incorrect 5 ms 376 KB Output isn't correct
10 Runtime error 5 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 5 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Incorrect 5 ms 376 KB Output isn't correct
13 Runtime error 5 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 6 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 5 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 5 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 6 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 7 ms 424 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# Verdict Execution time Memory Grader output
1 Runtime error 7 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 19 ms 1144 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 15 ms 888 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 5 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 12 ms 760 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 5 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 7 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 5 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 15 ms 888 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 14 ms 888 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 10 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 5 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 6 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 6 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 11 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 18 ms 1144 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 5 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 19 ms 1144 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# Verdict Execution time Memory Grader output
1 Runtime error 13 ms 888 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 13 ms 888 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 12 ms 1016 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 6 ms 508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 19 ms 1252 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 6 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 19 ms 1272 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 12 ms 888 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 12 ms 892 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 6 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 6 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 6 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 9 ms 760 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 6 ms 380 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 6 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 6 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 11 ms 760 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 12 ms 1016 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 6 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 13 ms 888 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Runtime error 5 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
22 Runtime error 18 ms 1272 KB Execution killed with signal 11 (could be triggered by violating memory limits)
23 Runtime error 9 ms 760 KB Execution killed with signal 11 (could be triggered by violating memory limits)
24 Runtime error 5 ms 508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Runtime error 6 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
26 Runtime error 5 ms 508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
27 Runtime error 19 ms 1272 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Runtime error 5 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
29 Runtime error 18 ms 1276 KB Execution killed with signal 11 (could be triggered by violating memory limits)
30 Runtime error 14 ms 1016 KB Execution killed with signal 11 (could be triggered by violating memory limits)
31 Runtime error 6 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
32 Runtime error 5 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
33 Runtime error 5 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
34 Runtime error 19 ms 1272 KB Execution killed with signal 11 (could be triggered by violating memory limits)
35 Runtime error 6 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
36 Runtime error 18 ms 1272 KB Execution killed with signal 11 (could be triggered by violating memory limits)
37 Runtime error 19 ms 1272 KB Execution killed with signal 11 (could be triggered by violating memory limits)
38 Runtime error 6 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
39 Runtime error 6 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
40 Runtime error 6 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
41 Runtime error 19 ms 1272 KB Execution killed with signal 11 (could be triggered by violating memory limits)
42 Runtime error 6 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)