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 = (int) 2e3 + 9;
const int inf = (int) 1e9 + 9;
long long n, x, a[N], lis_dp[N];
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n >> x;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int ans = 1;
for (int ii = n - 1; ii >= 0; ii--) {
a[ii] += x;
fill(lis_dp, lis_dp + n, inf);
for (int i = 0; i < n; i++) {
int j = lower_bound(lis_dp, lis_dp + n, a[i]) - lis_dp;
lis_dp[j] = a[i];
ans = max(ans, j + 1);
}
}
cout << ans << '\n';
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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |