| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1288712 | ozod_legend | Stove (JOI18_stove) | Pypy 3 | 188 ms | 59124 KiB |
n_k = input().split()
n = int(n_k[0])
k = int(n_k[1])
t = []
for i in range(n):
a = int(input())
t.append(a)
gaps = []
i = 0
while i < n - 1:
gap = t[i + 1] - (t[i] + 1)
gaps.append(gap)
i = i + 1
gaps.sort()
gaps.reverse()
total = (t[n - 1] + 1) - t[0]
s = 0
i = 0
while i < k - 1 and i < len(gaps):
s = s + gaps[i]
i = i + 1
ans = total - s
print(ans)
Compilation message (stdout)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
