#include<bits/stdc++.h>
using namespace std;
int main(){
int n,k;
cin>>n>>k;
vector<int> poles(n);
for(int i=0;i<n;i++){
cin>>poles[i];
}
int ans=0;
if(poles[0]>k){
ans++;
poles[0]=k;
}
for(int i=1;i<n;i++){
if(poles[i]-poles[i-1]>k){
ans++;
poles[i]=poles[i-1]+k;
}
}
cout<<ans<<endl;
}
| # | 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... |