Created
October 10, 2015 06:56
-
-
Save jo32/ee4468bcd7ba002fe700 to your computer and use it in GitHub Desktop.
CODEFORCES 337A
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import math | |
| [n, m] = [int(i) for i in raw_input().split(' ')] | |
| f = [int(i) for i in raw_input().split(' ')] | |
| f = sorted(f); | |
| minDist = min([(f[i + n - 1] - f[i]) for i in range(m - n + 1)]) if m > n else f[n - 1] - f[0] | |
| print minDist |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment