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;
#define sz(x) (int)(x).size()
const int MAXN = 2e5;
int n, m;
int v[MAXN];
vector<int> dp, possible;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
cin >> n >> m;
for(int i = 0; i < n; i++){
cin >> v[i];
if(v[i] <= (i + 1) * m) possible.push_back((i + 1) * m - v[i]);
}
for(auto x : possible){
auto it = upper_bound(dp.begin(), dp.end(), x) - dp.begin();
if(it == sz(dp)) dp.push_back(x);
else dp[it] = x;
}
cout << n - sz(dp);
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... |