제출 #757577

#제출 시각아이디문제언어결과실행 시간메모리
757577Desh03Rabbit Carrot (LMIO19_triusis)C++17
0 / 100
1 ms416 KiB
#include <bits/stdc++.h>
using namespace std;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, m, ans = 0;
    cin >> n >> m;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    if (a[0] > m) a[0] = m, ++ans;
    for (int i = 1; i < n; i++)
        if (a[i] > m + a[i - 1])
            a[i] = m + a[i - 1], ++ans;
    cout << ans << '\n';
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...