Submission #581443

#TimeUsernameProblemLanguageResultExecution timeMemory
581443colossal_pepeFinancial Report (JOI21_financial)C++17
0 / 100
122 ms260360 KiB
#include <iostream> #include <cstring> using namespace std; int n, d, a[405], dp[405][405][405]; int brutus(int i, int j, int k) { if (i > n) return (j == n ? 0 : -500); if (dp[i][j][k] != -1000) return dp[i][j][k]; if (j != 0 and i - j > d) dp[i][j][k] = -500; else dp[i][j][k] = max(brutus(i + 1, j, k), (a[i] > a[k]) + brutus(i + 1, i, (a[i] > a[k] ? i : k))); return dp[i][j][k]; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n >> d; a[0] = 0; for (int i = 1; i <= n; i++) { cin >> a[i]; } for (int i = 0; i < 405; i++) { for (int j = 0; j < 405; j++) { for (int k = 0; k < 405; k++) { dp[i][j][k] = -1000; } } } if (n > 400) cout << "parina eishob" << '\n'; else cout << brutus(1, 0, 0) << '\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...