제출 #617398

#제출 시각아이디문제언어결과실행 시간메모리
617398Abrar_Al_SamitFinancial Report (JOI21_financial)C++17
0 / 100
4075 ms527564 KiB
#include<bits/stdc++.h> using namespace std; const int MX = 405; int dp[MX][MX][MX]; int n, D; int a[MX]; int solve(int i, int can, int bigID) { if(i==n) { return (a[i]>a[bigID]); } int &ret = dp[i][can][bigID]; if(ret!=-1) return ret; ret = 0; ret = solve(i+1, D-1, (a[i]>a[bigID]?i:bigID)) + (a[i]>a[bigID]); if(can) { ret = max(ret, solve(i+1, can-1, bigID)); } return ret; } void PlayGround() { cin>>n>>D; for(int i=1; i<=n; ++i) { cin>>a[i]; } memset(dp, -1, sizeof dp); cout<<solve(1, n, 0)<<'\n'; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); PlayGround(); 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...