제출 #921966

#제출 시각아이디문제언어결과실행 시간메모리
921966tombRabbit Carrot (LMIO19_triusis)C++17
0 / 100
1 ms436 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...