H=input
G=int
E=range
C,F=map(G,H().split())
A=[]
for B in E(C):A.append(G(H()))
D=A[-1]-A[0]+1
A.sort()
I=[]
for B in E(C-1):A[B]=A[B+1]-A[B]-1
del A[-1]
A.sort()
for B in E(F-1):D-=A[-B-1]
print(D)
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
33 ms |
18164 KB |
Output is correct |
2 |
Correct |
34 ms |
18232 KB |
Output is correct |
3 |
Correct |
34 ms |
18192 KB |
Output is correct |
4 |
Correct |
42 ms |
18220 KB |
Output is correct |
5 |
Correct |
34 ms |
18196 KB |
Output is correct |
6 |
Correct |
34 ms |
18144 KB |
Output is correct |
7 |
Correct |
36 ms |
18188 KB |
Output is correct |
8 |
Correct |
35 ms |
18260 KB |
Output is correct |
9 |
Correct |
34 ms |
18148 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
33 ms |
18164 KB |
Output is correct |
2 |
Correct |
34 ms |
18232 KB |
Output is correct |
3 |
Correct |
34 ms |
18192 KB |
Output is correct |
4 |
Correct |
42 ms |
18220 KB |
Output is correct |
5 |
Correct |
34 ms |
18196 KB |
Output is correct |
6 |
Correct |
34 ms |
18144 KB |
Output is correct |
7 |
Correct |
36 ms |
18188 KB |
Output is correct |
8 |
Correct |
35 ms |
18260 KB |
Output is correct |
9 |
Correct |
34 ms |
18148 KB |
Output is correct |
10 |
Correct |
79 ms |
21796 KB |
Output is correct |
11 |
Correct |
78 ms |
21796 KB |
Output is correct |
12 |
Correct |
78 ms |
21800 KB |
Output is correct |
13 |
Correct |
79 ms |
21828 KB |
Output is correct |
14 |
Correct |
81 ms |
21788 KB |
Output is correct |
15 |
Correct |
82 ms |
21864 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
33 ms |
18164 KB |
Output is correct |
2 |
Correct |
34 ms |
18232 KB |
Output is correct |
3 |
Correct |
34 ms |
18192 KB |
Output is correct |
4 |
Correct |
42 ms |
18220 KB |
Output is correct |
5 |
Correct |
34 ms |
18196 KB |
Output is correct |
6 |
Correct |
34 ms |
18144 KB |
Output is correct |
7 |
Correct |
36 ms |
18188 KB |
Output is correct |
8 |
Correct |
35 ms |
18260 KB |
Output is correct |
9 |
Correct |
34 ms |
18148 KB |
Output is correct |
10 |
Correct |
79 ms |
21796 KB |
Output is correct |
11 |
Correct |
78 ms |
21796 KB |
Output is correct |
12 |
Correct |
78 ms |
21800 KB |
Output is correct |
13 |
Correct |
79 ms |
21828 KB |
Output is correct |
14 |
Correct |
81 ms |
21788 KB |
Output is correct |
15 |
Correct |
82 ms |
21864 KB |
Output is correct |
16 |
Correct |
206 ms |
26684 KB |
Output is correct |
17 |
Correct |
203 ms |
26688 KB |
Output is correct |
18 |
Correct |
244 ms |
27080 KB |
Output is correct |
19 |
Correct |
216 ms |
26740 KB |
Output is correct |
20 |
Correct |
209 ms |
26668 KB |
Output is correct |
21 |
Correct |
204 ms |
27048 KB |
Output is correct |
22 |
Correct |
211 ms |
26728 KB |
Output is correct |
23 |
Correct |
200 ms |
26696 KB |
Output is correct |
24 |
Correct |
201 ms |
27112 KB |
Output is correct |