Submission #1012698

# Submission time Handle Problem Language Result Execution time Memory
1012698 2024-07-02T13:56:56 Z MMihalev Rabbit Carrot (LMIO19_triusis) C++17
0 / 100
0 ms 348 KB
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<tuple>
#include<set>
#include<map>
#include<random>
#include<chrono>
using namespace std;
const int MAX_N=2e5+3;
int a[MAX_N];
int n;
int m;
int dp[MAX_N];
signed main ()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n>>m;

    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }

    for(int i=1;i<=n+1;i++)
    {
        dp[i]=1e9;
    }

    for(int i=1;i<=n+1;i++)
    {
        for(int j=0;j<i;j++)
        {
            if(a[j]+(i-j)*m>=a[i]){dp[i]=min(dp[i],dp[j]+(i-j-1));break;}
        }
    }

    cout<<dp[n+1]<<"\n";

    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -