Submission #160514

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

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

void 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++){
            if(i - (i % a[j]) >= 0){
                dp[i] = min(dp[i], 1 + dp[i - (i % a[j])]);
            }
        }
    }
}

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:24: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:26:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &a[i]);
         ~~~~~^~~~~~~~~~~~~
brunhilda.cpp:29: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 3 ms 760 KB Output isn't correct
2 Incorrect 4 ms 760 KB Output isn't correct
3 Incorrect 4 ms 760 KB Output isn't correct
4 Incorrect 2 ms 760 KB Output isn't correct
5 Incorrect 3 ms 760 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 2 ms 760 KB Output isn't correct
10 Incorrect 1 ms 760 KB Output isn't correct
11 Incorrect 3 ms 760 KB Output isn't correct
12 Incorrect 3 ms 780 KB Output isn't correct
13 Incorrect 38 ms 768 KB Output isn't correct
14 Incorrect 3 ms 760 KB Output isn't correct
15 Incorrect 3 ms 760 KB Output isn't correct
16 Incorrect 3 ms 760 KB Output isn't correct
17 Incorrect 2 ms 760 KB Output isn't correct
18 Incorrect 2 ms 760 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1079 ms 888 KB Time limit exceeded
2 Execution timed out 1071 ms 1272 KB Time limit exceeded
3 Execution timed out 1072 ms 1144 KB Time limit exceeded
4 Execution timed out 1071 ms 760 KB Time limit exceeded
5 Execution timed out 1077 ms 1144 KB Time limit exceeded
6 Execution timed out 1068 ms 1204 KB Time limit exceeded
7 Execution timed out 1073 ms 888 KB Time limit exceeded
8 Runtime error 942 ms 2168 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Execution timed out 1080 ms 1144 KB Time limit exceeded
10 Execution timed out 1079 ms 1144 KB Time limit exceeded
11 Execution timed out 1065 ms 988 KB Time limit exceeded
12 Execution timed out 1074 ms 888 KB Time limit exceeded
13 Execution timed out 1085 ms 760 KB Time limit exceeded
14 Execution timed out 1075 ms 760 KB Time limit exceeded
15 Execution timed out 1079 ms 1020 KB Time limit exceeded
16 Execution timed out 1070 ms 1272 KB Time limit exceeded
17 Execution timed out 1085 ms 764 KB Time limit exceeded
18 Execution timed out 1071 ms 1272 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 1077 ms 1276 KB Time limit exceeded
2 Execution timed out 1084 ms 1272 KB Time limit exceeded
3 Execution timed out 1072 ms 1144 KB Time limit exceeded
4 Execution timed out 1079 ms 760 KB Time limit exceeded
5 Execution timed out 1071 ms 1272 KB Time limit exceeded
6 Execution timed out 1068 ms 760 KB Time limit exceeded
7 Execution timed out 1063 ms 1272 KB Time limit exceeded
8 Execution timed out 1059 ms 1144 KB Time limit exceeded
9 Execution timed out 1067 ms 1272 KB Time limit exceeded
10 Execution timed out 1071 ms 888 KB Time limit exceeded
11 Execution timed out 1074 ms 888 KB Time limit exceeded
12 Execution timed out 1068 ms 888 KB Time limit exceeded
13 Execution timed out 1081 ms 1144 KB Time limit exceeded
14 Runtime error 32 ms 2168 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Execution timed out 1081 ms 888 KB Time limit exceeded
16 Execution timed out 1066 ms 888 KB Time limit exceeded
17 Execution timed out 1079 ms 1144 KB Time limit exceeded
18 Execution timed out 1065 ms 1272 KB Time limit exceeded
19 Execution timed out 1078 ms 888 KB Time limit exceeded
20 Execution timed out 1077 ms 1272 KB Time limit exceeded
21 Runtime error 100 ms 2128 KB Execution killed with signal 11 (could be triggered by violating memory limits)
22 Execution timed out 1078 ms 1272 KB Time limit exceeded
23 Execution timed out 1083 ms 1144 KB Time limit exceeded
24 Runtime error 1022 ms 2040 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Execution timed out 1080 ms 760 KB Time limit exceeded
26 Execution timed out 1067 ms 888 KB Time limit exceeded
27 Execution timed out 1075 ms 1272 KB Time limit exceeded
28 Runtime error 921 ms 2248 KB Execution killed with signal 11 (could be triggered by violating memory limits)
29 Execution timed out 1070 ms 1272 KB Time limit exceeded
30 Execution timed out 1086 ms 1148 KB Time limit exceeded
31 Execution timed out 1077 ms 888 KB Time limit exceeded
32 Execution timed out 1077 ms 888 KB Time limit exceeded
33 Execution timed out 1086 ms 1144 KB Time limit exceeded
34 Execution timed out 1083 ms 1272 KB Time limit exceeded
35 Execution timed out 1072 ms 1060 KB Time limit exceeded
36 Execution timed out 1072 ms 1272 KB Time limit exceeded
37 Execution timed out 1076 ms 1272 KB Time limit exceeded
38 Execution timed out 1084 ms 760 KB Time limit exceeded
39 Execution timed out 1081 ms 888 KB Time limit exceeded
40 Execution timed out 1083 ms 1016 KB Time limit exceeded
41 Execution timed out 1081 ms 1272 KB Time limit exceeded
42 Execution timed out 1081 ms 888 KB Time limit exceeded