제출 #805160

#제출 시각아이디문제언어결과실행 시간메모리
805160myst6Financial Report (JOI21_financial)C++14
0 / 100
4021 ms2652 KiB
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(0)->sync_with_stdio(0); int n, d; cin >> n >> d; vector<int> A(n); for (int i=0; i<n; i++) cin >> A[i]; vector<int> dp(n,1); int ans = 0; for (int i=0; i<n; i++) { for (int j=max(0,i-d); j<i; j++) { if (A[j] < A[i]) { dp[i] = max(dp[i], dp[j]+1); } if (A[j] == A[i]) { dp[i] = max(dp[i], dp[j]); } } ans = max(ans, dp[i]); } cout << ans << "\n"; 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...