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>
#define int long long
using namespace std;
signed main() {
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n, m; cin >> n >> m;
vector<int> a(n), dp;
for(int &p : a) cin >> p;
for(int i=0; i<n; i++) {
int p=m*(i+1)-a[i];
if(p<0) continue;
auto it=lower_bound(dp.begin(), dp.end(), p);
if(it==dp.end()) dp.push_back(p-1);
else *it=p-1;
}
cout << n-(int)dp.size() << '\n';
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... |