Submission #1123300

#TimeUsernameProblemLanguageResultExecution timeMemory
1123300ezzzayRabbit Carrot (LMIO19_triusis)C++20
0 / 100
33 ms328 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define ff first #define ss second #define pb push_back const int N=3e5+5; int dp[N]; int a[N]; signed main(){ int n,k; cin>>n>>k; for(int i=1;i<=n;i++)cin>>a[i]; int ans=0; dp[0]=1; for(int i=1;i<=n;i++){ for(int j=0;j<i;j++){ if(a[i]-a[j]>=k)continue; dp[i]=max(dp[i],dp[j]+1); } ans=max(ans,dp[i]); } cout<<n-ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...