# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
564546 | nikatamliani | Financial Report (JOI21_financial) | C++14 | 4085 ms | 1604 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;
const int N = 3e5+10;
int n, d;
int a[N], on[N], rgh[N], dp[N], t[4 * N];
int main() {
cin >> n >> d;
for (int i = 1; i <= n; ++i) {
cin >> a[i];
}
for (int i = 1; i <= n; ++i) {
int count = 0, pos = rgh[i] = i;
for (int j = i + 1; j <= n; ++j) {
if (j - pos > d) break;
if (a[j] <= a[i]) pos = j;
rgh[i] = j;
}
}
int best = 0;
rgh[0] = n;
for (int i = 1; i <= n; ++i) {
for (int j = 0; j < i; ++j) {
if (rgh[j] >= i && a[j] < a[i]) {
dp[i] = max(dp[i], dp[j] + 1);
}
}
best = max(best, dp[i]);
}
cout << best << endl;
}
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... |