Submission #736834

#TimeUsernameProblemLanguageResultExecution timeMemory
736834josanneo22Financial Report (JOI21_financial)C++17
48 / 100
4067 ms5824 KiB
#include<bits/stdc++.h> using namespace std; #define pb push_back #define pii pair<int,int> #define fi first #define se second void solve(){ int n,d; cin>>n>>d; vector<int> a(n); for(auto&x:a) cin>>x; vector<int>dp(n,1); for(int i=n-2;i>=0;i--){ int pos=min(n-1,i+d); for(int j=i+1;j<=pos;j++){ if(a[j]>a[i]) dp[i]=max(dp[i],dp[j]+1); else pos=min(j+d,n-1); } } cout<<*max_element(dp.begin(),dp.end()); } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); solve(); }
#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...