blob: 310fccf96d514417096c0f23bf1aa9e6d210ae15 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
from queue import PriorityQueue
def halfway_length(a,b):
return abs(a-b)/2
N = int(input())
q = PriorityQueue()
for i in range(N):
V = int(input())
q.put(V)
prev = q.get()
prev_length = 1000000000
smallest_length = None
while not q.empty():
current = q.get()
d = halfway_length(current, prev)
prev_length += d
if smallest_length is None or prev_length < smallest_length:
smallest_length = prev_length
prev_length = d
prev = current
print(smallest_length)
|