#include <bits/stdc++.h>
#define int int64_t
using ll = int64_t;
using namespace std;
constexpr int maxn = 1E5 + 1;
void orz() {
int n, k;
cin >> n >> k;
vector <int> a(n + 1);
for(int i = 1; i <= n; ++i) cin >> a[i];
vector <int> dp(n + 1, LLONG_MIN);
dp[0] = 0;
for(int i = 1; i <= n; i++) {
for(int j = 0; j < i; j++) {
if((i - j) * k >= a[i] - a[j]) {
dp[i] = max(dp[i], dp[j] + 1);
}
}
}
int ans = *max_element(dp.begin(), dp.end());
ans = n - ans;
cout << ans;
}
int32_t main() {
ios_base::sync_with_stdio(false), cin.tie(nullptr);
//freopen("promote.in", "r", stdin);
//freopen("promote.out", "w", stdout);
int T = 1;
//cin >> T;
while(T--) orz();
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |