Submission #864232

#TimeUsernameProblemLanguageResultExecution timeMemory
864232vjudge1Financial Report (JOI21_financial)C++17
28 / 100
4049 ms1048576 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n, d, i, j, k, m = 0; cin >> n >> d; vector<int> v(n); vector<vector<int> > dp(n); for (i = 0; i < n; i++) { cin >> v[i]; dp[i].resize(i + 1); for (j = 0; j <= i; j++) { dp[i][j] = 0; if (j) { dp[i][j] = 1000000001; for (k = i - 1; k >= 0 && k >= i - d; k--) { if (j - 1 <= k && dp[k][j - 1] < v[i]) dp[i][j] = min(dp[i][j], dp[k][j - 1]); else if (j <= k) dp[i][j] = min(dp[i][j], dp[k][j]); } } dp[i][j] = max(dp[i][j], v[i]); if (i == n - 1 && dp[i][j] < 1000000001) m = j; } } cout << m + 1; 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...