# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
610981 | lucas_joel_han | Rabbit Carrot (LMIO19_triusis) | C++14 | 1 ms | 320 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;
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int N, M;
cin >> N >> M;
vector<int> a(N), b;
for (int i = 0; i < N; i++) {
cin >> a[i];
if (M * i >= a[i])
b.push_back(M * i - a[i]);
}
vector<int> dp(b.size() + 1, INT_MAX);
dp[0] = INT_MIN;
for (int i = 0; i < b.size(); i++) {
int x = b[i];
int j = upper_bound(dp.begin(), dp.end(), x) - dp.begin();
if (dp[j - 1] <= x && x <= dp[j]) {
dp[j] = x;
}
}
int sol = 0;
for (int i = 0; i <= b.size(); i++) {
if (dp[i] != INT_MAX) {
sol = i;
}
}
cout << (N - sol) << '\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... |