Submission #1164709

#TimeUsernameProblemLanguageResultExecution timeMemory
1164709Ghulam_JunaidRabbit Carrot (LMIO19_triusis)C++20
0 / 100
8 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; if (dp[ans] + m < x) ans++; if (ans == i){ memset(dp, 0, sizeof dp); dp[i] = i * m; continue; } for (ll j = i; j >= ans; 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...