제출 #1164696

#제출 시각아이디문제언어결과실행 시간메모리
1164696Ghulam_JunaidRabbit Carrot (LMIO19_triusis)C++20
0 / 100
27 ms328 KiB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int main(){
    ll n, m;
    cin >> n >> m;

    ll dp[n + 5] = {}, ans = 0;
    for (ll i = 1; i <= n; i ++){
        ll x;
        cin >> x;

        for (ll j = 0; j < i; j ++)
            if (dp[j] + m < x)
                ans = max(ans, j + 1);

        if (ans == i){
            dp[i] = i * m;
            continue;
        }

        for (ll j = ans; j <= i; j ++){
            if (!j) dp[j] = x;
            else dp[j] = max(x, dp[j - 1] + m);
        }
    }
    cout << ans << endl;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...