I=input
H=int
F=range
B,G=map(H,I().split())
D=[]
for A in F(B):D.append(H(I()))
C=[]
for A in F(1,B):C.append(D[A]-D[A-1])
C=sorted(C)
E=0
for A in F(B-G):E+=C[A]-1
print(E+B)
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
34 ms |
18220 KB |
Output is correct |
2 |
Correct |
34 ms |
18200 KB |
Output is correct |
3 |
Correct |
35 ms |
18136 KB |
Output is correct |
4 |
Correct |
37 ms |
18132 KB |
Output is correct |
5 |
Correct |
36 ms |
18212 KB |
Output is correct |
6 |
Correct |
35 ms |
18148 KB |
Output is correct |
7 |
Correct |
34 ms |
18176 KB |
Output is correct |
8 |
Correct |
34 ms |
18220 KB |
Output is correct |
9 |
Correct |
34 ms |
18188 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
34 ms |
18220 KB |
Output is correct |
2 |
Correct |
34 ms |
18200 KB |
Output is correct |
3 |
Correct |
35 ms |
18136 KB |
Output is correct |
4 |
Correct |
37 ms |
18132 KB |
Output is correct |
5 |
Correct |
36 ms |
18212 KB |
Output is correct |
6 |
Correct |
35 ms |
18148 KB |
Output is correct |
7 |
Correct |
34 ms |
18176 KB |
Output is correct |
8 |
Correct |
34 ms |
18220 KB |
Output is correct |
9 |
Correct |
34 ms |
18188 KB |
Output is correct |
10 |
Correct |
81 ms |
22072 KB |
Output is correct |
11 |
Correct |
84 ms |
22056 KB |
Output is correct |
12 |
Correct |
84 ms |
22072 KB |
Output is correct |
13 |
Correct |
79 ms |
21764 KB |
Output is correct |
14 |
Correct |
95 ms |
21840 KB |
Output is correct |
15 |
Correct |
85 ms |
21828 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
34 ms |
18220 KB |
Output is correct |
2 |
Correct |
34 ms |
18200 KB |
Output is correct |
3 |
Correct |
35 ms |
18136 KB |
Output is correct |
4 |
Correct |
37 ms |
18132 KB |
Output is correct |
5 |
Correct |
36 ms |
18212 KB |
Output is correct |
6 |
Correct |
35 ms |
18148 KB |
Output is correct |
7 |
Correct |
34 ms |
18176 KB |
Output is correct |
8 |
Correct |
34 ms |
18220 KB |
Output is correct |
9 |
Correct |
34 ms |
18188 KB |
Output is correct |
10 |
Correct |
81 ms |
22072 KB |
Output is correct |
11 |
Correct |
84 ms |
22056 KB |
Output is correct |
12 |
Correct |
84 ms |
22072 KB |
Output is correct |
13 |
Correct |
79 ms |
21764 KB |
Output is correct |
14 |
Correct |
95 ms |
21840 KB |
Output is correct |
15 |
Correct |
85 ms |
21828 KB |
Output is correct |
16 |
Correct |
216 ms |
29344 KB |
Output is correct |
17 |
Correct |
211 ms |
28960 KB |
Output is correct |
18 |
Correct |
215 ms |
28900 KB |
Output is correct |
19 |
Correct |
206 ms |
29032 KB |
Output is correct |
20 |
Correct |
211 ms |
29460 KB |
Output is correct |
21 |
Correct |
210 ms |
28624 KB |
Output is correct |
22 |
Correct |
207 ms |
29364 KB |
Output is correct |
23 |
Correct |
212 ms |
28992 KB |
Output is correct |
24 |
Correct |
215 ms |
28876 KB |
Output is correct |