# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
582719 | ngano_upat_na | Rabbit Carrot (LMIO19_triusis) | C++17 | 0 ms | 0 KiB |
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>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, m;
cin >> n >> m;
vector<ll> v(n);
for (int i=0; i<n; i++) cin >> v[i];
ll cur = 0, ans = 0;
for (int i=0; i<n; i++) {
if (v[i] - cur <= m) {
cur = v[i];
}
else {
ans++;
cur = += m;
}
}
cout << ans;
}