# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
582719 | 2022-06-24T10:45:56 Z | ngano_upat_na | Rabbit Carrot (LMIO19_triusis) | C++17 | 0 ms | 0 KB |
#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; }