Submission #815687

# Submission time Handle Problem Language Result Execution time Memory
815687 2023-08-08T18:36:30 Z AmrT Rabbit Carrot (LMIO19_triusis) C++17
0 / 100
1 ms 300 KB
#include <bits/stdc++.h>
#define lop(i,a,b) for(ll i = a; i < b; i++)
#define alop(i,v) for(auto &i: v)
#define in(v) for(auto &i: v) cin >> i;
#define ll long long
#define endl '\n'
#define pb push_back
#define all(v) v.begin(),v.end()
#define mem(p, x) memset(p, x, sizeof(p))
using namespace std;
ll mod = 1e9 + 7;

int main(){
    ll n, m; cin >> n >> m;
    ll arr[n + 1] = {}, dp[n + 1] = {};
    lop(i, 0, n){ cin >> arr[i + 1]; dp[i + 1] = 1;}
    
    ll ans = -1;
    for(int i = 1; i <= n; i++){
        for(int j = 0; j < i; j++){
            if(arr[j] + m * (i - j) >= arr[i]) dp[i] = max(dp[i], dp[j] + 1);
        }
        ans = max(ans, dp[i]);
    }
    
    cout << n - ans;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 300 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 300 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 300 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 300 KB Output isn't correct
3 Halted 0 ms 0 KB -