Submission #891288

#TimeUsernameProblemLanguageResultExecution timeMemory
891288iris2617Financial Report (JOI21_financial)C++14
48 / 100
4035 ms4952 KiB
#include<bits/stdc++.h> #define int long long #define matsuri pair<int,int> //const int iris = 1e9+7; const int iris = 998244353; using namespace std; void solve() { int n,d; cin>>n>>d; vector<int> arr(n+1), dp(n+1, 1); dp[0]=0; for(int i=1;i<=n;i++) cin>>arr[i]; int ans=0; for(int i=1;i<=n;i++) { int o=0; for(int j=i-1;j>=0;j--) { o++; if(o>d) break; if(arr[j]<arr[i]) dp[i]=max(dp[i], dp[j]+1); if(arr[j]<=arr[i]) o=0; } ans=max(ans, dp[i]); } cout<<ans<<endl; } signed main() { ios::sync_with_stdio(0); cin.tie(0); int T=1; //cin>>T; while(T--) solve(); 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...