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 <cstdio>
#include <algorithm>
using namespace std;
int n,l,ep,sep;
long long res;
int main(){
int i,a,now;
scanf("%d %d",&n,&l);
ep=-21e8; sep=-21e8;
for(i=0;i<n;i++){
scanf("%d",&a);
if(a-l<=ep){
now=max(sep,a-l);
res+=max(0,ep-now);
sep=ep;
}
ep=a+l;
}
printf("%lld",res);
return 0;
}
# | 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... |