Submission #912251

# Submission time Handle Problem Language Result Execution time Memory
912251 2024-01-19T08:58:59 Z vjudge1 Rabbit Carrot (LMIO19_triusis) C++17
63 / 100
1000 ms 262144 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<=i;x++){
			dp[i][x]=-1e18;
			if(a[i]<=dp[i-1][x]+m)dp[i][x]=a[i];
			if(x>0)dp[i][x]=max(dp[i][x],dp[i-1][x-1]+m);
		}
	}
	for(int i=0;i<=n;i++){
		if(dp[n][i]>=0){
			cout<<i<<ent;
			return;
		}
	}
}

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 2648 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 2396 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 2392 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2404 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 2648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2648 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 2396 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 2392 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2404 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 2648 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2392 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 42 ms 162428 KB Output is correct
21 Correct 57 ms 197712 KB Output is correct
22 Correct 63 ms 197604 KB Output is correct
23 Correct 57 ms 197716 KB Output is correct
24 Correct 55 ms 197716 KB Output is correct
25 Correct 58 ms 197716 KB Output is correct
26 Correct 58 ms 198056 KB Output is correct
27 Correct 61 ms 197712 KB Output is correct
28 Correct 59 ms 197696 KB Output is correct
29 Correct 57 ms 197736 KB Output is correct
30 Correct 55 ms 197712 KB Output is correct
31 Correct 56 ms 197584 KB Output is correct
32 Correct 56 ms 197704 KB Output is correct
33 Correct 58 ms 197684 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 42 ms 162428 KB Output is correct
5 Correct 57 ms 197712 KB Output is correct
6 Correct 63 ms 197604 KB Output is correct
7 Correct 57 ms 197716 KB Output is correct
8 Correct 55 ms 197716 KB Output is correct
9 Correct 58 ms 197716 KB Output is correct
10 Correct 58 ms 198056 KB Output is correct
11 Correct 61 ms 197712 KB Output is correct
12 Correct 59 ms 197696 KB Output is correct
13 Correct 57 ms 197736 KB Output is correct
14 Correct 55 ms 197712 KB Output is correct
15 Correct 56 ms 197584 KB Output is correct
16 Correct 56 ms 197704 KB Output is correct
17 Correct 58 ms 197684 KB Output is correct
18 Correct 1 ms 2648 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 2396 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 2392 KB Output is correct
27 Correct 1 ms 2396 KB Output is correct
28 Correct 1 ms 2396 KB Output is correct
29 Correct 1 ms 2404 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 2648 KB Output is correct
34 Correct 57 ms 197712 KB Output is correct
35 Correct 57 ms 197536 KB Output is correct
36 Correct 66 ms 197548 KB Output is correct
37 Correct 59 ms 197768 KB Output is correct
38 Correct 61 ms 198184 KB Output is correct
39 Correct 56 ms 197712 KB Output is correct
40 Correct 55 ms 197604 KB Output is correct
41 Correct 65 ms 197716 KB Output is correct
42 Correct 57 ms 197712 KB Output is correct
43 Correct 56 ms 197736 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 57 ms 197712 KB Output is correct
2 Correct 57 ms 197536 KB Output is correct
3 Correct 66 ms 197548 KB Output is correct
4 Correct 59 ms 197768 KB Output is correct
5 Correct 61 ms 198184 KB Output is correct
6 Correct 56 ms 197712 KB Output is correct
7 Correct 55 ms 197604 KB Output is correct
8 Correct 65 ms 197716 KB Output is correct
9 Correct 57 ms 197712 KB Output is correct
10 Correct 56 ms 197736 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2392 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 42 ms 162428 KB Output is correct
15 Correct 57 ms 197712 KB Output is correct
16 Correct 63 ms 197604 KB Output is correct
17 Correct 57 ms 197716 KB Output is correct
18 Correct 55 ms 197716 KB Output is correct
19 Correct 58 ms 197716 KB Output is correct
20 Correct 58 ms 198056 KB Output is correct
21 Correct 61 ms 197712 KB Output is correct
22 Correct 59 ms 197696 KB Output is correct
23 Correct 57 ms 197736 KB Output is correct
24 Correct 55 ms 197712 KB Output is correct
25 Correct 56 ms 197584 KB Output is correct
26 Correct 56 ms 197704 KB Output is correct
27 Correct 58 ms 197684 KB Output is correct
28 Correct 1 ms 2648 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 1 ms 2396 KB Output is correct
35 Correct 1 ms 2396 KB Output is correct
36 Correct 1 ms 2392 KB Output is correct
37 Correct 1 ms 2396 KB Output is correct
38 Correct 1 ms 2396 KB Output is correct
39 Correct 1 ms 2404 KB Output is correct
40 Correct 1 ms 2396 KB Output is correct
41 Correct 1 ms 2396 KB Output is correct
42 Correct 1 ms 2396 KB Output is correct
43 Correct 1 ms 2648 KB Output is correct
44 Execution timed out 2437 ms 262144 KB Time limit exceeded
45 Halted 0 ms 0 KB -