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 ll long long
#define vll vector<ll>
using namespace std;
int main(){
int n;
ll m;
cin >> n >> m;
vll poles(n);
for (int i = 0; i < n; i++) cin >> poles[i];
ll prev = 0;
int ans = 0;
for (ll curr : poles){
if (curr < prev)
prev = curr;
else {
if (curr - prev > m)
ans++, prev = prev + m;
else prev = curr;
}
}
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... |