Submission #815683

# Submission time Handle Problem Language Result Execution time Memory
815683 2023-08-08T18:28:01 Z AmrT Rabbit Carrot (LMIO19_triusis) C++17
0 / 100
1 ms 212 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] = {}, p[n + 1];
    lop(i, 0, n) cin >> arr[i + 1];
    
    ll ans = 0;
    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 << ans;

    return 0;
}

Compilation message

triusis.cpp: In function 'int main()':
triusis.cpp:15:41: warning: unused variable 'p' [-Wunused-variable]
   15 |     ll arr[n + 1] = {}, dp[n + 1] = {}, p[n + 1];
      |                                         ^
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -