제출 #1284418

#제출 시각아이디문제언어결과실행 시간메모리
1284418zxzuamRabbit Carrot (LMIO19_triusis)C++20
63 / 100
1095 ms3392 KiB
#include <bits/stdc++.h> #define int int64_t using ll = int64_t; using namespace std; constexpr int maxn = 1E5 + 1; void orz() { int n, k; cin >> n >> k; vector <int> a(n + 1); for(int i = 1; i <= n; ++i) cin >> a[i]; vector <int> dp(n + 1, LLONG_MIN); dp[0] = 0; for(int i = 1; i <= n; i++) { for(int j = 0; j < i; j++) { if((i - j) * k >= a[i] - a[j]) { dp[i] = max(dp[i], dp[j] + 1); } } } int ans = *max_element(dp.begin(), dp.end()); ans = n - ans; cout << ans; } int32_t main() { ios_base::sync_with_stdio(false), cin.tie(nullptr); //freopen("promote.in", "r", stdin); //freopen("promote.out", "w", stdout); int T = 1; //cin >> T; while(T--) orz(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...