Submission #521747

#TimeUsernameProblemLanguageResultExecution timeMemory
521747penguin133Rabbit Carrot (LMIO19_triusis)C++14
63 / 100
1087 ms1736 KiB
#include <bits/stdc++.h> using namespace std; int dp[200005], A[200005]; int main(){ int n,m, maxi =0 ;cin >> n >> m; for(int i=1;i<=n;i++)cin >> A[i]; for(int i=1;i<=n;i++){ if(A[i] > m * i)dp[i] = -1e9; else { for(int j=0;j<i;j++)if(A[i] - m*(i-j) <= A[j])dp[i] = max(dp[i], dp[j] + 1); } maxi = max(maxi, dp[i]); } cout << n-maxi; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...