Submission #619628

# Submission time Handle Problem Language Result Execution time Memory
619628 2022-08-02T13:49:50 Z Valenz Feast (NOI19_feast) C++14
21 / 100
1000 ms 262144 KB
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
signed main()
{
	int n,k;
	cin >> n >> k;
	vector<int> a(n+1);
	a[0]=0;
	for(int i=1;i<=n;i++)
	{
		cin >> a[i];	
		a[i]+=a[i-1];
	}
	vector<vector<int>> dp(n+1,vector<int>(k+1,0));
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=k;j++)
		{
			dp[i][j]=max(dp[i][j],dp[i-1][j]);
			if(j>0)
			{
				for(int l=0;l<i;l++)
				{
					dp[i][j]=max(dp[i][j],dp[l][j-1]+(a[i]-a[l]));
				}
			}
		}
	}
	cout << dp[n][k] << '\n';
 
	return 0;
}
# Verdict Execution time Memory Grader output
1 Runtime error 203 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 19716 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1078 ms 21808 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 296 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 304 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 296 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 304 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 3 ms 340 KB Output is correct
12 Correct 3 ms 444 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 3 ms 340 KB Output is correct
15 Correct 2 ms 296 KB Output is correct
16 Correct 2 ms 340 KB Output is correct
17 Correct 3 ms 436 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 296 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 304 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 3 ms 340 KB Output is correct
12 Correct 3 ms 444 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 3 ms 340 KB Output is correct
15 Correct 2 ms 296 KB Output is correct
16 Correct 2 ms 340 KB Output is correct
17 Correct 3 ms 436 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 643 ms 3428 KB Output is correct
22 Execution timed out 1043 ms 25988 KB Time limit exceeded
23 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 203 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -