Submission #1288712

#TimeUsernameProblemLanguageResultExecution timeMemory
1288712ozod_legendStove (JOI18_stove)Pypy 3
100 / 100
188 ms59124 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)

Compiling 'stove.py'...

=======
  adding: __main__.pyc (deflated 31%)

=======
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...