Submission #1117228

# Submission time Handle Problem Language Result Execution time Memory
1117228 2024-11-23T04:21:15 Z fdnfksd Holding (COCI20_holding) C++14
55 / 110
14 ms 8784 KB
#include <iostream>
using namespace std;
int n,l,r,K,a[105],dp[105][105][2505]={0},res=0;
int main() {
	cin>>n>>l>>r>>K;
	for (int i=1; i<=n; i++) cin>>a[i];
	for (int i=1; i<=l-1; i++)
	for (int j=l; j<=r; j++)
	for (int k=0; k<=K; k++) {
		dp[i][j][k]=min(dp[i-1][j][k],dp[i][j-1][k]);
		if(k>=abs(i-j)) dp[i][j][k]=min(dp[i][j][k],dp[i-1][j-1][k-abs(i-j)]-a[j]+a[i]);
	}
	int mn=0;
	for (int i=0; i<=K; i++)
		mn=min(mn,dp[l-1][r][i]);
	for (int i=l; i<=r; i++) res+=a[i];
	cout<<res+mn;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 592 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 2 ms 848 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 592 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 2 ms 848 KB Output is correct
8 Correct 3 ms 2812 KB Output is correct
9 Correct 3 ms 2640 KB Output is correct
10 Correct 3 ms 3152 KB Output is correct
11 Correct 3 ms 3164 KB Output is correct
12 Correct 2 ms 8784 KB Output is correct
13 Correct 14 ms 7416 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 592 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 2 ms 848 KB Output is correct
8 Correct 3 ms 2812 KB Output is correct
9 Correct 3 ms 2640 KB Output is correct
10 Correct 3 ms 3152 KB Output is correct
11 Correct 3 ms 3164 KB Output is correct
12 Correct 2 ms 8784 KB Output is correct
13 Correct 14 ms 7416 KB Output is correct
14 Correct 2 ms 592 KB Output is correct
15 Correct 2 ms 1104 KB Output is correct
16 Incorrect 2 ms 4944 KB Output isn't correct
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 592 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 2 ms 848 KB Output is correct
8 Correct 3 ms 2812 KB Output is correct
9 Correct 3 ms 2640 KB Output is correct
10 Correct 3 ms 3152 KB Output is correct
11 Correct 3 ms 3164 KB Output is correct
12 Correct 2 ms 8784 KB Output is correct
13 Correct 14 ms 7416 KB Output is correct
14 Correct 2 ms 592 KB Output is correct
15 Correct 2 ms 1104 KB Output is correct
16 Incorrect 2 ms 4944 KB Output isn't correct
17 Halted 0 ms 0 KB -