Submission #883273

#TimeUsernameProblemLanguageResultExecution timeMemory
88327312345678Financial Report (JOI21_financial)C++17
48 / 100
4075 ms4544 KiB
#include <bits/stdc++.h> using namespace std; const int nx=3e5+5; int n, d, v[nx], l[nx], dp[nx], ans; int main() { cin.tie(NULL)->sync_with_stdio(false); cin>>n>>d; for (int i=1; i<=n; i++) { cin>>v[i]; dp[i]=1; l[i]=i; for (int j=1; j<i; j++) { if (i-l[j]>d) continue; if (v[j]<v[i]) dp[i]=max(dp[i], dp[j]+1); else l[j]=i; } } for (int i=1; i<=n; i++) if (l[i]==n) ans=max(ans, dp[i]); cout<<ans; }
#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...