Submission #160511

# Submission time Handle Problem Language Result Execution time Memory
160511 2019-10-28T08:46:00 Z tushar_2658 Brunhilda’s Birthday (BOI13_brunhilda) C++14
0 / 100
1000 ms 2168 KB
#include "bits/stdc++.h"
using namespace std;

const int maxn = 100005;
int a[maxn], dp[maxn], n, m;

int solve(int x){
    for(int i = 0; i < maxn; i++){
        dp[i] = 1e8;
    }
    dp[0] = 0; 
    for(int i = 1; i <= x; i++){
        for(int j = 1; j <= n; j++){
            dp[i] = min(dp[i], 1 + dp[i - (i % a[j])]);
        }
    }
    return dp[x];
}

int main(int argc, char const *argv[])
{
  //  freopen("in.txt", "r", stdin);
    scanf("%d %d", &n, &m); 
    for(int i = 1; i <= n; i++){
        scanf("%d", &a[i]);
    }
    int x; 
    scanf("%d", &x); 
    solve(x);
    dp[x] >= 1e8 ? printf("oo\n") : printf("%d\n", dp[x]);

    return 0;
}

Compilation message

brunhilda.cpp: In function 'int main(int, const char**)':
brunhilda.cpp:23:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d", &n, &m); 
     ~~~~~^~~~~~~~~~~~~~~~~
brunhilda.cpp:25:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &a[i]);
         ~~~~~^~~~~~~~~~~~~
brunhilda.cpp:28:10: 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 2 ms 760 KB Output isn't correct
2 Incorrect 3 ms 760 KB Output isn't correct
3 Incorrect 2 ms 760 KB Output isn't correct
4 Incorrect 3 ms 760 KB Output isn't correct
5 Incorrect 2 ms 632 KB Output isn't correct
6 Incorrect 2 ms 760 KB Output isn't correct
7 Incorrect 2 ms 760 KB Output isn't correct
8 Incorrect 2 ms 760 KB Output isn't correct
9 Incorrect 7 ms 760 KB Output isn't correct
10 Incorrect 3 ms 760 KB Output isn't correct
11 Incorrect 3 ms 760 KB Output isn't correct
12 Incorrect 3 ms 760 KB Output isn't correct
13 Incorrect 40 ms 760 KB Output isn't correct
14 Incorrect 2 ms 760 KB Output isn't correct
15 Incorrect 3 ms 760 KB Output isn't correct
16 Incorrect 3 ms 632 KB Output isn't correct
17 Incorrect 2 ms 632 KB Output isn't correct
18 Incorrect 2 ms 632 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1077 ms 760 KB Time limit exceeded
2 Execution timed out 1079 ms 1272 KB Time limit exceeded
3 Execution timed out 1077 ms 1272 KB Time limit exceeded
4 Execution timed out 1074 ms 760 KB Time limit exceeded
5 Execution timed out 1076 ms 1116 KB Time limit exceeded
6 Execution timed out 1068 ms 1196 KB Time limit exceeded
7 Execution timed out 1076 ms 760 KB Time limit exceeded
8 Runtime error 948 ms 2168 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Execution timed out 1083 ms 1148 KB Time limit exceeded
10 Execution timed out 1078 ms 1272 KB Time limit exceeded
11 Execution timed out 1066 ms 1020 KB Time limit exceeded
12 Execution timed out 1085 ms 1016 KB Time limit exceeded
13 Execution timed out 1065 ms 760 KB Time limit exceeded
14 Execution timed out 1071 ms 760 KB Time limit exceeded
15 Execution timed out 1082 ms 1016 KB Time limit exceeded
16 Execution timed out 1084 ms 1272 KB Time limit exceeded
17 Execution timed out 1077 ms 760 KB Time limit exceeded
18 Execution timed out 1074 ms 1400 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 1073 ms 1272 KB Time limit exceeded
2 Execution timed out 1077 ms 1144 KB Time limit exceeded
3 Execution timed out 1083 ms 1272 KB Time limit exceeded
4 Execution timed out 1073 ms 760 KB Time limit exceeded
5 Execution timed out 1077 ms 1272 KB Time limit exceeded
6 Execution timed out 1086 ms 760 KB Time limit exceeded
7 Execution timed out 1083 ms 1400 KB Time limit exceeded
8 Execution timed out 1077 ms 1276 KB Time limit exceeded
9 Execution timed out 1077 ms 1276 KB Time limit exceeded
10 Execution timed out 1078 ms 760 KB Time limit exceeded
11 Execution timed out 1081 ms 760 KB Time limit exceeded
12 Execution timed out 1077 ms 760 KB Time limit exceeded
13 Execution timed out 1063 ms 1016 KB Time limit exceeded
14 Runtime error 32 ms 2012 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Execution timed out 1080 ms 760 KB Time limit exceeded
16 Execution timed out 1072 ms 760 KB Time limit exceeded
17 Execution timed out 1081 ms 1144 KB Time limit exceeded
18 Execution timed out 1086 ms 1144 KB Time limit exceeded
19 Execution timed out 1086 ms 760 KB Time limit exceeded
20 Execution timed out 1069 ms 1272 KB Time limit exceeded
21 Runtime error 98 ms 2148 KB Execution killed with signal 11 (could be triggered by violating memory limits)
22 Execution timed out 1084 ms 1400 KB Time limit exceeded
23 Execution timed out 1081 ms 1144 KB Time limit exceeded
24 Execution timed out 1064 ms 2168 KB Time limit exceeded
25 Execution timed out 1086 ms 760 KB Time limit exceeded
26 Execution timed out 1076 ms 760 KB Time limit exceeded
27 Execution timed out 1073 ms 1272 KB Time limit exceeded
28 Runtime error 924 ms 2040 KB Execution killed with signal 11 (could be triggered by violating memory limits)
29 Execution timed out 1074 ms 1400 KB Time limit exceeded
30 Execution timed out 1083 ms 1148 KB Time limit exceeded
31 Execution timed out 1082 ms 760 KB Time limit exceeded
32 Execution timed out 1084 ms 760 KB Time limit exceeded
33 Execution timed out 1089 ms 1144 KB Time limit exceeded
34 Execution timed out 1078 ms 1272 KB Time limit exceeded
35 Execution timed out 1087 ms 888 KB Time limit exceeded
36 Execution timed out 1077 ms 1272 KB Time limit exceeded
37 Execution timed out 1076 ms 1400 KB Time limit exceeded
38 Execution timed out 1088 ms 760 KB Time limit exceeded
39 Execution timed out 1085 ms 892 KB Time limit exceeded
40 Execution timed out 1083 ms 760 KB Time limit exceeded
41 Execution timed out 1074 ms 1272 KB Time limit exceeded
42 Execution timed out 1092 ms 760 KB Time limit exceeded