# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
874949 | efedmrlr | Financial Report (JOI21_financial) | C++17 | 4101 ms | 8276 KiB |
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;
#define int long long int
#define MP make_pair
#define pb push_back
#define REP(i,n) for(int (i) = 0; (i)<(n); (i)++)
void fastio() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
const int N = 1e5+5;
const int MOD = 1e9+7;
const int INF = 1e12;
const int M = 1e6+5;
const long double EPS = 0.00001;
int n,m,q,d;
vector<int> a, dp;
signed main() {
cin>>n>>d;
a.resize(n+1);
dp.assign(n + 1, 1);
REP(i,n) cin>>a[i + 1];
dp[n] = 1;
for(int i = n - 1; i>=1; i--) {
int cnt = 0;
for(int j = i + 1; j<=n; j++) {
cnt++;
if(cnt > d) {
break;
}
if(a[j] > a[i]) {
dp[i] = max(dp[i], dp[j] + 1);
}
else {
cnt = 0;
}
}
}
int ans = 0;
for(int i = 1; i<=n; i++) {
ans = max(ans ,dp[i]);
}
cout<<ans<<"\n";
}
Compilation message (stderr)
# | 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... |