Submission #98180

# Submission time Handle Problem Language Result Execution time Memory
98180 2019-02-21T07:44:50 Z onjo0127 Candies (JOI18_candies) C++11
8 / 100
53 ms 23288 KB
#include <bits/stdc++.h>
using namespace std;

int A[2009];
long long D[2][1009][2009];

int main() {
    int N; scanf("%d",&N);
    for(int i=1; i<=N; i++) scanf("%d",&A[i]);
    for(int i=1; i<=N; i++) {
        for(int j=1; j<=(i+1)/2; j++) {
            D[0][j][i] = max(D[0][j][i-1], D[1][j][i-1]);
            D[1][j][i] = D[0][j-1][i-1] + A[i];
        }
    }
    for(int i=1; i<=(N+1)/2; i++) printf("%lld\n", max(D[0][i][N], D[1][i][N]));
    return 0;
}

Compilation message

candies.cpp: In function 'int main()':
candies.cpp:8:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int N; scanf("%d",&N);
            ~~~~~^~~~~~~~~
candies.cpp:9:34: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i=1; i<=N; i++) scanf("%d",&A[i]);
                             ~~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 42 ms 23288 KB Output is correct
2 Correct 41 ms 23160 KB Output is correct
3 Correct 42 ms 23036 KB Output is correct
4 Correct 42 ms 23036 KB Output is correct
5 Correct 51 ms 23160 KB Output is correct
6 Correct 44 ms 23160 KB Output is correct
7 Correct 48 ms 23032 KB Output is correct
8 Correct 43 ms 23180 KB Output is correct
9 Correct 44 ms 23032 KB Output is correct
10 Correct 41 ms 23036 KB Output is correct
11 Correct 41 ms 23032 KB Output is correct
12 Correct 40 ms 23028 KB Output is correct
13 Correct 39 ms 23032 KB Output is correct
14 Correct 43 ms 23036 KB Output is correct
15 Correct 39 ms 23032 KB Output is correct
16 Correct 38 ms 23040 KB Output is correct
17 Correct 53 ms 23040 KB Output is correct
18 Correct 49 ms 23032 KB Output is correct
19 Correct 40 ms 23032 KB Output is correct
20 Correct 44 ms 23032 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 42 ms 23288 KB Output is correct
2 Correct 41 ms 23160 KB Output is correct
3 Correct 42 ms 23036 KB Output is correct
4 Correct 42 ms 23036 KB Output is correct
5 Correct 51 ms 23160 KB Output is correct
6 Correct 44 ms 23160 KB Output is correct
7 Correct 48 ms 23032 KB Output is correct
8 Correct 43 ms 23180 KB Output is correct
9 Correct 44 ms 23032 KB Output is correct
10 Correct 41 ms 23036 KB Output is correct
11 Correct 41 ms 23032 KB Output is correct
12 Correct 40 ms 23028 KB Output is correct
13 Correct 39 ms 23032 KB Output is correct
14 Correct 43 ms 23036 KB Output is correct
15 Correct 39 ms 23032 KB Output is correct
16 Correct 38 ms 23040 KB Output is correct
17 Correct 53 ms 23040 KB Output is correct
18 Correct 49 ms 23032 KB Output is correct
19 Correct 40 ms 23032 KB Output is correct
20 Correct 44 ms 23032 KB Output is correct
21 Execution timed out 4 ms 640 KB Time limit exceeded (wall clock)
22 Halted 0 ms 0 KB -