Submission #492296

#TimeUsernameProblemLanguageResultExecution timeMemory
492296mosiashvililukaFinancial Report (JOI21_financial)C++14
48 / 100
4050 ms5568 KiB
#include<bits/stdc++.h> using namespace std; int a,b,c,d,e,i,j,ii,jj,zx,xc,f[300009],dp[300009],D,pas; int main(){ ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0); cin>>a>>D; for(i=1; i<=a; i++){ cin>>f[i]; } for(i=1; i<=a; i++){ dp[i]=1;ii=i; for(j=i-1; j>=1; j--){ if(ii-j>D) break; if(f[j]<f[i]) ii=j; if(f[j]<f[i]){ dp[i]=max(dp[i],dp[j]+1); } } } for(i=1; i<=a; i++){ pas=max(pas,dp[i]); } /*for(i=1; i<=a; i++){ cout<<dp[i]<<" "; } cout<<"\n";*/ cout<<pas; 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...