Submission #224766

# Submission time Handle Problem Language Result Execution time Memory
224766 2020-04-18T18:39:53 Z tictaccat Feast (NOI19_feast) C++14
59 / 100
1000 ms 3668 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long

int N,K;
int A[500000];
int dp[2][2500];
int best[2][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%2][k] = A[i] + max(dp[(i+1)%2][k],best[(i+1)%2][k-1]);
            best[i%2][k] = max(best[(i+1)%2][k], dp[i%2][k]);
        }
    }

    cout << best[(N+1)%2][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 Execution timed out 1087 ms 3576 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 95 ms 3192 KB Output is correct
2 Correct 99 ms 3192 KB Output is correct
3 Correct 103 ms 3064 KB Output is correct
4 Execution timed out 1095 ms 3192 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 193 ms 3580 KB Output is correct
2 Correct 196 ms 3480 KB Output is correct
3 Correct 191 ms 3576 KB Output is correct
4 Correct 190 ms 3448 KB Output is correct
5 Correct 197 ms 3576 KB Output is correct
6 Correct 194 ms 3588 KB Output is correct
7 Correct 193 ms 3576 KB Output is correct
8 Correct 193 ms 3668 KB Output is correct
9 Correct 195 ms 3576 KB Output is correct
10 Correct 192 ms 3576 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 4 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 4 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 5 ms 256 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 4 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 5 ms 256 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
21 Correct 6 ms 384 KB Output is correct
22 Correct 11 ms 512 KB Output is correct
23 Correct 7 ms 384 KB Output is correct
24 Correct 7 ms 384 KB Output is correct
25 Correct 7 ms 384 KB Output is correct
26 Correct 6 ms 384 KB Output is correct
27 Correct 7 ms 384 KB Output is correct
28 Correct 6 ms 384 KB Output is correct
29 Correct 6 ms 384 KB Output is correct
30 Correct 6 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1087 ms 3576 KB Time limit exceeded
2 Halted 0 ms 0 KB -