Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #number of countries(#1 indexed)
- n = 99998
- #array of spacestations location (0-indexed)
- c = [28000, 58701, 43043, 24909, 28572]
- c.sort()
- end, start = 0,0
- #edge cases.
- #if there is no space station at the end
- if c[len(c)-1] != n:
- end = 1
- c.append(n - 1)
- #print(c)
- #if there is no space spation at the beginning
- if c[0] != 0:
- beginning = 1
- c.insert(0, 0)
- #print(c)
- #array of differences
- c_diff = []
- #find the difference of each value in c
- for i in range(len(c) - 1):
- c_diff.append(c[i+1] - c[i])
- #print(c_diff)
- if end == 1:
- c_diff[len(c_diff) - 1] *= 2
- if start == 1:
- c_diff[0] *= 2
- answer = max(c_diff)//2
- print(answer)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement