제출 #503416

#제출 시각아이디문제언어결과실행 시간메모리
503416DanerZeinFinancial Report (JOI21_financial)C++14
0 / 100
4011 ms8652 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MAX_N=3e5+10; vector<ll> x; int n,d; int dp[MAX_N]; int report(int id){ if(dp[id]!=-1) return dp[id]; if(id==n) return 0; int r; if(id==0) r=n; else r=min(n,id+d); int ans=0; for(int i=id+1;i<=r;i++){ if(x[i]>x[id]){ ans=max(ans,report(i)+1); } } return dp[id]=ans; } int main(){ memset(dp,-1,sizeof dp); cin>>n>>d; x.push_back(0); for(int i=0;i<n;i++){ ll a; cin>>a; x.push_back(a); } cout<<report(0)<<endl; }
#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...