Submission #528702

#TimeUsernameProblemLanguageResultExecution timeMemory
528702d2k05Financial Report (JOI21_financial)C++14
48 / 100
4083 ms5836 KiB
#include <bits/stdc++.h> #define fastio ios_base :: sync_with_stdio(0), cin.tie(0); using namespace std; using ll = long long; const int mxN = 1e6 + 5, mod = 1e9 + 7; int n, d, a[mxN], dp[mxN]; int main() { fastio; cin >> n >> d; for (int i = 1; i <= n; ++i) cin >> a[i], dp[i] = 1; int ans = 0; for (int i = 1; i <= n; ++i) { int l = i; for (int j = i + 1; j <= n; ++j) { if (a[j] <= a[i] && j - l <= d) l = j; if (a[j] > a[i] && j - l <= d) dp[j] = max(dp[j], dp[i] + 1); } if (n - l <= d) 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...