Submission #333054

# Submission time Handle Problem Language Result Execution time Memory
333054 2020-12-04T11:32:30 Z guka415 Feast (NOI19_feast) C++14
41 / 100
40 ms 66944 KB
#define fast ios::sync_with_stdio(false); cin.tie(0)
#define foru(i, k, n) for (int i = k; i < n; i++)
#define ford(i, k, n) for (int i = k; i >= n; i--)
#define pb push_back
#define mp make_pair

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <list>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int sz = 3e3;
int n, k;
ll a[sz], dpy[sz][sz], dpn[sz][sz];

int main() {
	fast;
	cin >> n >> k;
	foru(i, 0, n)cin >> a[i];
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= k; j++) {
			dpy[i][j] = a[i - 1] + max(dpn[i - 1][j - 1], dpy[i - 1][j]);
			dpn[i][j] = max(dpn[i - 1][j], dpy[i - 1][j]);
		}
	}
	cout << max(dpy[n][k], dpn[n][k]) << '\n';
	return 0;
}
# Verdict Execution time Memory Grader output
1 Runtime error 9 ms 492 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 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 8 ms 492 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 1 ms 1004 KB Output is correct
2 Correct 1 ms 1004 KB Output is correct
3 Correct 1 ms 876 KB Output is correct
4 Correct 1 ms 1132 KB Output is correct
5 Correct 1 ms 1004 KB Output is correct
6 Correct 1 ms 1004 KB Output is correct
7 Correct 1 ms 1004 KB Output is correct
8 Correct 1 ms 1004 KB Output is correct
9 Correct 1 ms 876 KB Output is correct
10 Correct 1 ms 1004 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1004 KB Output is correct
2 Correct 1 ms 1004 KB Output is correct
3 Correct 1 ms 876 KB Output is correct
4 Correct 1 ms 1132 KB Output is correct
5 Correct 1 ms 1004 KB Output is correct
6 Correct 1 ms 1004 KB Output is correct
7 Correct 1 ms 1004 KB Output is correct
8 Correct 1 ms 1004 KB Output is correct
9 Correct 1 ms 876 KB Output is correct
10 Correct 1 ms 1004 KB Output is correct
11 Correct 2 ms 2924 KB Output is correct
12 Correct 2 ms 2668 KB Output is correct
13 Correct 2 ms 2540 KB Output is correct
14 Correct 2 ms 2796 KB Output is correct
15 Correct 2 ms 2668 KB Output is correct
16 Correct 2 ms 2540 KB Output is correct
17 Correct 2 ms 2796 KB Output is correct
18 Correct 2 ms 2540 KB Output is correct
19 Correct 2 ms 2540 KB Output is correct
20 Correct 2 ms 2796 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1004 KB Output is correct
2 Correct 1 ms 1004 KB Output is correct
3 Correct 1 ms 876 KB Output is correct
4 Correct 1 ms 1132 KB Output is correct
5 Correct 1 ms 1004 KB Output is correct
6 Correct 1 ms 1004 KB Output is correct
7 Correct 1 ms 1004 KB Output is correct
8 Correct 1 ms 1004 KB Output is correct
9 Correct 1 ms 876 KB Output is correct
10 Correct 1 ms 1004 KB Output is correct
11 Correct 2 ms 2924 KB Output is correct
12 Correct 2 ms 2668 KB Output is correct
13 Correct 2 ms 2540 KB Output is correct
14 Correct 2 ms 2796 KB Output is correct
15 Correct 2 ms 2668 KB Output is correct
16 Correct 2 ms 2540 KB Output is correct
17 Correct 2 ms 2796 KB Output is correct
18 Correct 2 ms 2540 KB Output is correct
19 Correct 2 ms 2540 KB Output is correct
20 Correct 2 ms 2796 KB Output is correct
21 Correct 12 ms 22124 KB Output is correct
22 Correct 40 ms 66944 KB Output is correct
23 Correct 19 ms 27884 KB Output is correct
24 Correct 13 ms 22636 KB Output is correct
25 Correct 15 ms 25580 KB Output is correct
26 Correct 12 ms 21740 KB Output is correct
27 Correct 14 ms 24940 KB Output is correct
28 Correct 10 ms 17516 KB Output is correct
29 Correct 10 ms 17004 KB Output is correct
30 Correct 9 ms 16108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 9 ms 492 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -