#include <stdio.h>
#include <algorithm>
using namespace std;
int n,l;
long long sum;
long long slight[300000],elight[300000];
int main()
{
scanf("%d %d",&n, &l);
int i;
for(i = 1 ; i <= n ; i++){
scanf("%d",&slight[i]);
slight[i]-=l;
}
sort(slight+1,slight+1+n);
for(i = 1 ; i <= n ; i++){
elight[i]=slight[i]+l*2;
}
int s=slight[1],x=elight[1];
for(i = 2 ; i <= n ; i++){
if(s<slight[i])s=slight[i];
if(s<=x){
sum+=x-s;
s=x;
}
x=elight[i];
}
printf("%lld",sum);
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
5772 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
5772 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
5772 KB |
Output isn't correct |
4 |
Correct |
0 ms |
5772 KB |
Output is correct |
5 |
Incorrect |
0 ms |
5772 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
5772 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
5772 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
5772 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
5772 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
5772 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
5772 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
5772 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
5772 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
5772 KB |
Output isn't correct |
8 |
Incorrect |
0 ms |
5772 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
5772 KB |
Output isn't correct |
10 |
Incorrect |
0 ms |
5772 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
18 ms |
5772 KB |
Output isn't correct |
2 |
Incorrect |
49 ms |
5772 KB |
Output isn't correct |
3 |
Incorrect |
23 ms |
5772 KB |
Output isn't correct |
4 |
Incorrect |
35 ms |
5772 KB |
Output isn't correct |
5 |
Incorrect |
17 ms |
5772 KB |
Output isn't correct |
6 |
Incorrect |
3 ms |
5772 KB |
Output isn't correct |
7 |
Incorrect |
48 ms |
5772 KB |
Output isn't correct |
8 |
Incorrect |
31 ms |
5772 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
50 ms |
5772 KB |
Output isn't correct |
2 |
Incorrect |
50 ms |
5772 KB |
Output isn't correct |
3 |
Incorrect |
26 ms |
5772 KB |
Output isn't correct |
4 |
Incorrect |
51 ms |
5772 KB |
Output isn't correct |
5 |
Incorrect |
33 ms |
5772 KB |
Output isn't correct |
6 |
Incorrect |
3 ms |
5772 KB |
Output isn't correct |
7 |
Incorrect |
13 ms |
5772 KB |
Output isn't correct |
8 |
Incorrect |
32 ms |
5772 KB |
Output isn't correct |
9 |
Incorrect |
31 ms |
5772 KB |
Output isn't correct |
10 |
Incorrect |
25 ms |
5772 KB |
Output isn't correct |
11 |
Incorrect |
38 ms |
5772 KB |
Output isn't correct |
12 |
Incorrect |
50 ms |
5772 KB |
Output isn't correct |
13 |
Incorrect |
50 ms |
5772 KB |
Output isn't correct |
14 |
Incorrect |
40 ms |
5772 KB |
Output isn't correct |
15 |
Incorrect |
33 ms |
5772 KB |
Output isn't correct |