제출 #666269

#제출 시각아이디문제언어결과실행 시간메모리
666269Darren0724Financial Report (JOI21_financial)C++17
48 / 100
4049 ms10572 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define all(x) x.begin(),x.end() const int INF=1e18; const int mod=1e9+7; signed main(){ ios_base::sync_with_stdio(false); cin.tie(0); int n,k;cin>>n>>k; vector<int> v(n); for(int i=0;i<n;i++){ cin>>v[i]; } vector<int> dp(n); vector<bool> vis(n,1); vector<int> cnt(n); for(int i=0;i<n;i++){ dp[i]=1; for(int j=0;j<i;j++){ if(vis[j]==0){ continue; } if(v[i]>v[j]){ dp[i]=max(dp[i],dp[j]+1); } } for(int j=0;j<=i;j++){ if(v[j]>=v[i]){ cnt[j]=0; } else{ cnt[j]++; } if(cnt[j]>=k){ vis[j]=0; } } } int ans=0; for(int i=0;i<n;i++){ ans=max(ans,dp[i]); } cout<<ans<<endl; 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...