Submission #3742439


Source Code Expand

n,k = list(map(int,input().split()))
a = [0]*n
for i in range(n):
    a[i] = int(input())

a.sort()
ans = 9999999999999999999
for i in range(len(a)-(k-1)):
    x = a[i+k-1] - a[i]
    ans = min(ans,x)
print(ans)

Submission Info

Submission Time
Task C - Christmas Eve
User yharu63
Language Python (3.4.3)
Score 300
Code Size 221 Byte
Status AC
Exec Time 292 ms
Memory 7472 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 10
Set Name Test Cases
Sample a01, a02
All a01, a02, b03, b04, b05, b06, b07, b08, b09, b10
Case Name Status Exec Time Memory
a01 AC 19 ms 3060 KB
a02 AC 19 ms 3060 KB
b03 AC 19 ms 3060 KB
b04 AC 207 ms 6900 KB
b05 AC 292 ms 7468 KB
b06 AC 270 ms 7472 KB
b07 AC 279 ms 7472 KB
b08 AC 261 ms 7472 KB
b09 AC 250 ms 7468 KB
b10 AC 244 ms 7472 KB