# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1096680 | ezGeometry | Rabbit Carrot (LMIO19_triusis) | C++14 | 60 ms | 4296 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 <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<int> bunnies(n);
for (int i = 0; i < n; i++) {
int x;
cin >> x;
bunnies[i] = i * m + m - x;
}
vector<int> dp;
for (int i = 0; i < n; i++) {
if (bunnies[i] < 0) {
continue;
}
int pos = upper_bound(dp.begin(), dp.end(), bunnies[i]) - dp.begin();
if (pos == dp.size()) {
dp.push_back(bunnies[i]);
}
else {
dp[pos] = bunnies[i];
}
}
cout << n - dp.size() << 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... |