#include <iostream>
#include <vector>
#include <map>
#include <set>
#include<algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <queue>
#include<iomanip>
#include <array>
using namespace std;
const int MAXN = 2e5 + 11;
const int MOD = 998244353;
using ll = long long;
using ld = long double;
const int K = 26;
int n, m;
ll h[MAXN];
ll d[MAXN];
int x[MAXN];
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
//freopen("cowjog.in", "r", stdin);
//freopen("cowjog.out", "w", stdout);
cin >> n >> m;
int ind = 0;
for (int i = 0; i < n; i++)
{
cin >> x[i];
if (m * i >= x[i])
h[ind++] = m * i - x[i];
}
for (int i = 1; i <= n; i++)
d[i] = 1e18;
for (int i = 0; i < n; i++)
{
int l = upper_bound(d, d + n + 1, h[i]) - d;
if (d[l - 1] < h[i] && d[l] > h[i])
d[l] = h[i];
}
int ans = 0;
for (int i = 1; i <= n; i++)
if (d[i] < 1e18)
ans = i;
cout <<n - ans << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |