Submission #98180

#TimeUsernameProblemLanguageResultExecution timeMemory
98180onjo0127Candies (JOI18_candies)C++11
8 / 100
53 ms23288 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...