Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save inspirit941/b60639845a9bbd5a504341c4747cac64 to your computer and use it in GitHub Desktop.
Save inspirit941/b60639845a9bbd5a504341c4747cac64 to your computer and use it in GitHub Desktop.
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the flatlandSpaceStations function below.
def flatlandSpaceStations(n, c):
# first space, last space distance
c.sort()
max_value = max(c[0], n-c[-1]-1)
for idx in range(1, len(c)):
diff = c[idx] - c[idx-1]
dist = diff // 2
max_value = max(max_value, dist)
return max_value
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
nm = input().split()
n = int(nm[0])
m = int(nm[1])
c = list(map(int, input().rstrip().split()))
result = flatlandSpaceStations(n, c)
fptr.write(str(result) + '\n')
fptr.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment