Submission #1164761

#TimeUsernameProblemLanguageResultExecution timeMemory
1164761Ghulam_JunaidRabbit Carrot (LMIO19_triusis)C++20
0 / 100
53 ms328 KiB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

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

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

        ll ind = -1;
        for (ll j = ans; j <= n; j ++){
            if (dp[j] + m >= x){
                ind = j;
                break;
            }
        }

        for (ll j = ans + 1; j <= n; j ++)
            dp[j] = dp[j - 1] + m;
        if (ind == ans) dp[ind] = x;
        else ans++;
    }
    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...