This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
signed main() {
int n,d; cin>>n>>d;
vector<int>v(n);
for(auto &z : v)
cin>>z;
vector<int>dp(n+5);
int mx = 1;
for(int i = 0 ; i < n ; i++) {
dp[i] = 1;
for(int j = i-1 ; j >= max(0, i - d) ; j--) {
if(v[j] < v[i])
dp[i] = max(dp[i], dp[j] + 1);
}
mx = max(mx, dp[i]);
}
cout << mx;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |