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;
using ll = long long;
int main()
{
cin.tie(NULL) -> sync_with_stdio(false);
int N, M;
cin >> N >> M;
vector<int> v(N);
for (auto& i : v)
cin >> i;
vector<int> dp;
for (int i = 0; i < N; ++i)
{
int x = M * (i + 1) - v[i];
if (x < 0)
continue;
auto it = upper_bound(dp.begin(), dp.end(), x);
if (it == dp.end())
dp.push_back(x);
else
*it = x;
}
cout << N - dp.size() << endl;
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... |