제출 #654141

#제출 시각아이디문제언어결과실행 시간메모리
654141FarbodFinancial Report (JOI21_financial)C++17
0 / 100
5 ms468 KiB
#include <iostream> #include <vector> using namespace std; const int N = 7005; int n, d, a[N], dp[N], ans = 0; signed main() { cin >> n >> d; for (int i = 0; i < n; i++) cin >> a[i]; dp[n - 1] = 1; for (int i = n - 2; i >= 0; i--) { dp[i] = 1; int k = i; for (int j = i + 1; j < n; j++) { if (j - k > d) break; if (a[j] <= a[i]) k = j; else dp[i] = max(dp[i], dp[j] + 1); } ans = max(ans, dp[i]); } cout << ans; 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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...