Submission #1077263

# Submission time Handle Problem Language Result Execution time Memory
1077263 2024-08-27T04:16:39 Z YudoTLE Feast (NOI19_feast) C++17
41 / 100
27 ms 59472 KB
#include<bits/stdc++.h>
 
using namespace std;
 
const int N = 2007;
 
int n, K, a[N];
 
long long f[N][N][2], ans = 0;
 
int main() {
    ios_base::sync_with_stdio(NULL);
    cin.tie(NULL);
    cin >> n >> K;
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    for(int i = 1; i <= n; i++) {
        for(int j = 0; j <= K; j++) {
            f[i][j][0] = max(f[i - 1][j][0], f[i - 1][j][1]);
            if(j > 0) f[i][j][1] = max(f[i - 1][j - 1][0], f[i - 1][j][1]) + a[i];
        }
    }
    for(int i = 0; i <= K; i++) ans = max(ans, max(f[n][i][0], f[n][i][1]));
    cout << ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 600 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 8284 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
2 Correct 0 ms 860 KB Output is correct
3 Correct 0 ms 604 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 0 ms 604 KB Output is correct
9 Correct 0 ms 604 KB Output is correct
10 Correct 0 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
2 Correct 0 ms 860 KB Output is correct
3 Correct 0 ms 604 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 0 ms 604 KB Output is correct
9 Correct 0 ms 604 KB Output is correct
10 Correct 0 ms 604 KB Output is correct
11 Correct 1 ms 1624 KB Output is correct
12 Correct 1 ms 1628 KB Output is correct
13 Correct 1 ms 1628 KB Output is correct
14 Correct 1 ms 1628 KB Output is correct
15 Correct 1 ms 1628 KB Output is correct
16 Correct 1 ms 1372 KB Output is correct
17 Correct 1 ms 1628 KB Output is correct
18 Correct 1 ms 1372 KB Output is correct
19 Correct 1 ms 1628 KB Output is correct
20 Correct 1 ms 1628 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
2 Correct 0 ms 860 KB Output is correct
3 Correct 0 ms 604 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 0 ms 604 KB Output is correct
9 Correct 0 ms 604 KB Output is correct
10 Correct 0 ms 604 KB Output is correct
11 Correct 1 ms 1624 KB Output is correct
12 Correct 1 ms 1628 KB Output is correct
13 Correct 1 ms 1628 KB Output is correct
14 Correct 1 ms 1628 KB Output is correct
15 Correct 1 ms 1628 KB Output is correct
16 Correct 1 ms 1372 KB Output is correct
17 Correct 1 ms 1628 KB Output is correct
18 Correct 1 ms 1372 KB Output is correct
19 Correct 1 ms 1628 KB Output is correct
20 Correct 1 ms 1628 KB Output is correct
21 Correct 6 ms 14428 KB Output is correct
22 Correct 27 ms 59472 KB Output is correct
23 Correct 9 ms 20056 KB Output is correct
24 Correct 6 ms 14936 KB Output is correct
25 Correct 7 ms 17500 KB Output is correct
26 Correct 6 ms 13916 KB Output is correct
27 Correct 7 ms 16988 KB Output is correct
28 Correct 4 ms 9560 KB Output is correct
29 Correct 4 ms 9308 KB Output is correct
30 Correct 3 ms 8284 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 600 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -