Submission #912244

# Submission time Handle Problem Language Result Execution time Memory
912244 2024-01-19T08:51:24 Z vjudge1 Rabbit Carrot (LMIO19_triusis) C++17
35 / 100
195 ms 197812 KB
#include <bits/stdc++.h>
#define f first
#define s second	
#define ent '\n'
#define int long long

#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast,unroll-loops,fast-math,O3")

using namespace std;
typedef long long ll;
const int mx=1e6+12;
const int mod=1e9+7;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};

int dp[5001][5001];
int a[mx];
int n,m,k;

void Press_Fn_with_F11(){
	cin>>n>>m;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	for(int x=1;x<=5000;x++){
		dp[0][x]=1e18;
	}
	dp[0][0]=0;
	for(int i=1;i<=n;i++){
		for(int x=0;x<=5000;x++){
			dp[i][x]=dp[i-1][max(0ll,x-m)]+(a[i]!=x);
		}
		for(int x=4999;x>=0;x--){
			dp[i][x]=min(dp[i][x+1],dp[i][x]);
		}
	}
	cout<<dp[n][0]<<ent;
}

signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int Alikhan_abi_crush=1;
	// cin>>Alikhan_abi_crush;
	while(Alikhan_abi_crush--){
		Press_Fn_with_F11();
	}
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2652 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 2 ms 2396 KB Output is correct
11 Correct 1 ms 2508 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2652 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 2 ms 2396 KB Output is correct
11 Correct 1 ms 2508 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 156 ms 162644 KB Output is correct
21 Correct 187 ms 197716 KB Output is correct
22 Correct 182 ms 197648 KB Output is correct
23 Correct 183 ms 197716 KB Output is correct
24 Correct 183 ms 197684 KB Output is correct
25 Correct 183 ms 197712 KB Output is correct
26 Correct 186 ms 197712 KB Output is correct
27 Correct 195 ms 197716 KB Output is correct
28 Correct 186 ms 197676 KB Output is correct
29 Correct 190 ms 197656 KB Output is correct
30 Correct 183 ms 197720 KB Output is correct
31 Correct 183 ms 197696 KB Output is correct
32 Correct 185 ms 197812 KB Output is correct
33 Correct 183 ms 197712 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 156 ms 162644 KB Output is correct
5 Correct 187 ms 197716 KB Output is correct
6 Correct 182 ms 197648 KB Output is correct
7 Correct 183 ms 197716 KB Output is correct
8 Correct 183 ms 197684 KB Output is correct
9 Correct 183 ms 197712 KB Output is correct
10 Correct 186 ms 197712 KB Output is correct
11 Correct 195 ms 197716 KB Output is correct
12 Correct 186 ms 197676 KB Output is correct
13 Correct 190 ms 197656 KB Output is correct
14 Correct 183 ms 197720 KB Output is correct
15 Correct 183 ms 197696 KB Output is correct
16 Correct 185 ms 197812 KB Output is correct
17 Correct 183 ms 197712 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2652 KB Output is correct
24 Correct 1 ms 2396 KB Output is correct
25 Correct 1 ms 2396 KB Output is correct
26 Correct 1 ms 2396 KB Output is correct
27 Correct 2 ms 2396 KB Output is correct
28 Correct 1 ms 2508 KB Output is correct
29 Correct 1 ms 2396 KB Output is correct
30 Correct 1 ms 2396 KB Output is correct
31 Correct 1 ms 2396 KB Output is correct
32 Correct 1 ms 2396 KB Output is correct
33 Correct 1 ms 2396 KB Output is correct
34 Correct 189 ms 197720 KB Output is correct
35 Incorrect 184 ms 197716 KB Output isn't correct
36 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 189 ms 197720 KB Output is correct
2 Incorrect 184 ms 197716 KB Output isn't correct
3 Halted 0 ms 0 KB -