# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
786668 | nonono | Rabbit Carrot (LMIO19_triusis) | C++14 | 29 ms | 4128 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 mxN = 2e5 + 10;
int n, m;
int h[mxN];
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n >> m;
for(int i = 1; i <= n; i ++) cin >> h[i];
for(int i = 1; i <= n; i ++) {
h[i] = h[i] - i * m;
}
vector<int> LIS;
for(int i = n; i >= 1; i --) {
int x = upper_bound(LIS.begin(), LIS.end(), h[i]) - LIS.begin();
if(x == LIS.size()) LIS.push_back(h[i]);
else
LIS[x] = min(LIS[x], h[i]);
}
cout << n - (upper_bound(LIS.begin(), LIS.end(), 0) - LIS.begin()) << "\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... |