# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
551159 | tht2005 | Financial Report (JOI21_financial) | C++17 | 4033 ms | 6724 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 = 300005;
int n, d, m, a[N], v[N], f[N];
int main() {
scanf("%d %d", &n, &d);
for(int i = 0; i < n; ++i) {
scanf("%d", a + i);
v[i] = a[i];
}
sort(v, v + n);
m = unique(v, v + n) - v;
for(int i = 0; i < n; ++i) {
a[i] = lower_bound(v, v + m, a[i]) - v;
}
for(int i = 0; i < n; ++i) {
f[i] = 1;
for(int j = i, cnt = 0; j--; ) {
if(a[j] < a[i]) {
f[i] = max(f[i], f[j] + 1);
cnt = 0;
}
else if((++cnt) == d) {
break;
}
}
}
printf("%d", *max_element(f, f + n));
return 0;
}
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... |