# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
700219 | LucasLe | Rabbit Carrot (LMIO19_triusis) | C++17 | 1 ms | 212 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() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
//freopen("cowjog.out", "w", stdout);
#endif
int N, M; cin >> N >> M;
vector<int> b;
for (int i = 1; i <= N; ++i) {
int x; cin >> x;
if (x <= M * i) {
b.push_back(M * i - x);
}
}
vector<int> lis;
for (int x : b) {
int pos = upper_bound(lis.begin(), lis.end(), x) - lis.begin();
if (pos == lis.size()) lis.push_back(x);
else lis[pos] = x;
}
cout << N - lis.size();
}
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... |