#include <bits/stdc++.h>
using namespace std;
int main() {
int n, d, ans = 0;
cin >> n >> d;
int a[n+1]; a[0] = 0;
for(int i = 1; i <= n; i++)
cin >> a[i];
int dp[n+1];
dp[0] = 0;
for(int i = 1; i <= n; i++) {
if(a[i] - a[dp[i-1]] < d) {
dp[i] = i;
ans++;
} else
dp[i] = dp[i-1];
}
cout << n - ans << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |