Submission #533145

#TimeUsernameProblemLanguageResultExecution timeMemory
5331454fectaFinancial Report (JOI21_financial)C++17
0 / 100
4097 ms4992 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define int ll #define ld long double #define pii pair<int, int> #define f first #define s second #define boost() cin.tie(0), cin.sync_with_stdio(0) const int MN = 300005; int n, d, a[MN], ans = 1, dp[MN]; int32_t main() { boost(); cin >> n >> d; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = n; i > 0; i--) { dp[i] = 1; for (int j = i + 1; j <= min(n, i + d); j++) { if (a[i] < a[j]) dp[i] = max(dp[i], dp[j] + 1); } ans = max(ans, dp[i]); } printf("%lld\n", 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...