#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct |
7 |
Correct |
0 ms |
1084 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct |
8 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct |
10 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
12 ms |
1084 KB |
Output isn't correct |
2 |
Incorrect |
22 ms |
1084 KB |
Output isn't correct |
3 |
Incorrect |
22 ms |
1084 KB |
Output isn't correct |
4 |
Incorrect |
22 ms |
1084 KB |
Output isn't correct |
5 |
Incorrect |
21 ms |
1084 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct |
7 |
Incorrect |
19 ms |
1084 KB |
Output isn't correct |
8 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
18 ms |
1084 KB |
Output isn't correct |
2 |
Incorrect |
25 ms |
1084 KB |
Output isn't correct |
3 |
Incorrect |
2 ms |
1084 KB |
Output isn't correct |
4 |
Incorrect |
13 ms |
1084 KB |
Output isn't correct |
5 |
Incorrect |
25 ms |
1084 KB |
Output isn't correct |
6 |
Incorrect |
28 ms |
1084 KB |
Output isn't correct |
7 |
Incorrect |
26 ms |
1084 KB |
Output isn't correct |
8 |
Incorrect |
22 ms |
1084 KB |
Output isn't correct |
9 |
Incorrect |
18 ms |
1084 KB |
Output isn't correct |
10 |
Incorrect |
35 ms |
1084 KB |
Output isn't correct |
11 |
Incorrect |
23 ms |
1084 KB |
Output isn't correct |
12 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct |
13 |
Incorrect |
16 ms |
1084 KB |
Output isn't correct |
14 |
Incorrect |
13 ms |
1084 KB |
Output isn't correct |
15 |
Incorrect |
15 ms |
1084 KB |
Output isn't correct |