Submission #647608

# Submission time Handle Problem Language Result Execution time Memory
647608 2022-10-03T09:57:26 Z billyisme Feast (NOI19_feast) C++14
21 / 100
1000 ms 16300 KB
#include<bits/stdc++.h>
using namespace std ;
#define ll long long 
#define pb push_back 
#define pk pop_back 
#define pii pair<int,int> 
#define X first 
#define Y second 

const int N =2e3+5 , oo = 1e9 ; 
const ll inf = 1e17 , cs = 330 , sm = 1e9+7 ; 

int n  , k ;  
ll a[N] ,s[N] ; 
ll  f[N][N] ; 
ll res=0 ; 
ll ma[N][N] ;
void inp()
{
	cin>> n >> k ; 
	for(int i=1;i<=n;i++)
	{
		cin>>a[i] ; 
		s[i] =s[i-1]+a[i] ; 
	}
}
void solve()
{
	for(int i=1 ;i<=n;i++)
	{
		for(int j= 1;j<=k;j++)
		{
			for(int t= 1;t<=i;t++)
			{
				f[i][j] =max(f[i][j],s[i]-s[t-1]+ma[t-1][j-1]);
				ma[i][j] = max(ma[i-1][j],f[i][j]); 
				res=max(res,f[i][j]) ; 
			}
		}
	}
	cout<<res;
}
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0) ; cout.tie(0) ; 
	int t = 1; 
	while(t--)
	{
		inp() ; 
		solve() ; 
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 512 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 468 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 980 KB Output is correct
2 Correct 1 ms 968 KB Output is correct
3 Correct 1 ms 852 KB Output is correct
4 Correct 1 ms 852 KB Output is correct
5 Correct 2 ms 968 KB Output is correct
6 Correct 2 ms 852 KB Output is correct
7 Correct 1 ms 852 KB Output is correct
8 Correct 2 ms 852 KB Output is correct
9 Correct 1 ms 840 KB Output is correct
10 Correct 1 ms 876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 980 KB Output is correct
2 Correct 1 ms 968 KB Output is correct
3 Correct 1 ms 852 KB Output is correct
4 Correct 1 ms 852 KB Output is correct
5 Correct 2 ms 968 KB Output is correct
6 Correct 2 ms 852 KB Output is correct
7 Correct 1 ms 852 KB Output is correct
8 Correct 2 ms 852 KB Output is correct
9 Correct 1 ms 840 KB Output is correct
10 Correct 1 ms 876 KB Output is correct
11 Correct 9 ms 2900 KB Output is correct
12 Correct 7 ms 2664 KB Output is correct
13 Correct 4 ms 2516 KB Output is correct
14 Correct 7 ms 2644 KB Output is correct
15 Correct 7 ms 2644 KB Output is correct
16 Correct 5 ms 2516 KB Output is correct
17 Correct 7 ms 2744 KB Output is correct
18 Correct 3 ms 2516 KB Output is correct
19 Correct 3 ms 2516 KB Output is correct
20 Correct 3 ms 2640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 980 KB Output is correct
2 Correct 1 ms 968 KB Output is correct
3 Correct 1 ms 852 KB Output is correct
4 Correct 1 ms 852 KB Output is correct
5 Correct 2 ms 968 KB Output is correct
6 Correct 2 ms 852 KB Output is correct
7 Correct 1 ms 852 KB Output is correct
8 Correct 2 ms 852 KB Output is correct
9 Correct 1 ms 840 KB Output is correct
10 Correct 1 ms 876 KB Output is correct
11 Correct 9 ms 2900 KB Output is correct
12 Correct 7 ms 2664 KB Output is correct
13 Correct 4 ms 2516 KB Output is correct
14 Correct 7 ms 2644 KB Output is correct
15 Correct 7 ms 2644 KB Output is correct
16 Correct 5 ms 2516 KB Output is correct
17 Correct 7 ms 2744 KB Output is correct
18 Correct 3 ms 2516 KB Output is correct
19 Correct 3 ms 2516 KB Output is correct
20 Correct 3 ms 2640 KB Output is correct
21 Execution timed out 1047 ms 16300 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 512 KB Output isn't correct
2 Halted 0 ms 0 KB -