Submission #224731

# Submission time Handle Problem Language Result Execution time Memory
224731 2020-04-18T16:57:24 Z tictaccat Feast (NOI19_feast) C++14
0 / 100
416 ms 206712 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long

int N,K;
int A[500000];
int dp[2500][2500];
int best[2500][2500];

main() {

    cin >> N >> K;
    for (int i = 0; i < N; i++) cin >> A[i];

    for (int i = 0; i < N; i++) {
        for (int k = 1; k <= K; k++) {
            dp[i][k] = A[i] + max(dp[i-1][k],best[i-1][k-1]);
            best[i][k] = max(best[i-1][k], dp[i][k]);
        }
    }

    cout << best[N-1][K] << "\n";

}

Compilation message

feast.cpp:10:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main() {
      ^
# Verdict Execution time Memory Grader output
1 Runtime error 416 ms 206712 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 175 ms 46712 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 267 ms 46712 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 1024 KB Output is correct
2 Incorrect 5 ms 1024 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 1024 KB Output is correct
2 Incorrect 5 ms 1024 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 1024 KB Output is correct
2 Incorrect 5 ms 1024 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 416 ms 206712 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -