제출 #821604

#제출 시각아이디문제언어결과실행 시간메모리
821604Youssif_ElkadiRabbit Carrot (LMIO19_triusis)C++17
63 / 100
1074 ms2348 KiB
#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 5, M = 11, inf = 1e9 + 5, mod = 1e9 + 7;
long long dp[N];
long long n, m;
long long arr[N];
int main()
{
    cin >> n >> m;
    dp[0] = 0;
    long long mx = 0;
    for (long long i = 1; i <= n; i++)
        dp[i] = -inf;
    for (long long i = 1; i <= n; i++)
    {
        cin >> arr[i];
        for (long long j = i - 1; j >= 0; j--)
        {
            if (arr[j] + m * (i - j) >= arr[i])
            {
                dp[i] = max(dp[i], dp[j] + 1), mx = max(mx, dp[i]);
                // cout << i << " " << j << "\n";
            }
        }
    }
    cout << n - mx;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...