#include <bits/stdc++.h>
using namespace std;
int main() {
// freopen(".in", "r", stdin);
// freopen(".out", "w", stdout);
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, m; cin >> n >> m;
vector<int> a(n);
for(int i = 0; i < n; i++) {
cin >> a[i];
}
vector<int> b;
for(int i = 1; i < n; i++) {
if ((i+1)*m >= a[i]) b.push_back((i+1)*m - a[i]);
}
vector<int> dp;
for(int i = 0; i < (int)size(b); i++) {
int pos = int(upper_bound(begin(b), end(b), b[i])-begin(b));
if (pos >= int(size(dp))) {
dp.push_back(pos);
} else dp[pos] = b[i];
}
cout << n - int(size(dp)) << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |