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 F first
#define S second
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, m;
cin >> n >> m;
vector<int> a(n+1);
for(int i = 1; i <= n; i++){
cin >> a[i];
}
int ans = 0;
vector<bool> edited(n+1);
edited[0] = 1;
for(int i = 1; i <= n; i++){
if(a[i] - a[i-1] <= m){
continue;
}
ans++;
if(!edited[i-1]){
edited[i-1] = 1;
a[i-1] = a[i];
}
else{
edited[i] = 1;
a[i] = a[i-1] + m;
}
}
cout << ans << "\n";
}
# | 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... |