• + 3 comments

    I used the same technique but i am failing the test cases.

    Code :

    !/bin/python3

    import sys

    n,m = input().strip().split(' ') n,m = [int(n),int(m)]

    space_stations = [0] space_stations += [int(c_temp) for c_temp in input().strip().split(' ')] space_stations.append(n)

    space_stations.sort()

    max_distance = 0

    d1 = space_stations[1] d2 = n - space_stations[m + 1]

    for j in range(m + 1): distance = space_stations[j + 1] - space_stations[j] if distance > max_distance: max_distance = distance

    max_distance /= 2

    print(int(max(max_distance, d1, d2)))