10
-405 -230 252 -393 -390 -259 97 163 81 -129
 3
10000 -10000 10000
 1
-10000
 20
-16 -23 29 44 -40 -50 -41 34 -38 30 -12 28 -44 -49 15 50 -28 38 -2 0

702.333333333333712
 10000.000000000016371
 0.000000000000000
 113.875000000000043


import java.math.BigDecimal;
import java.util.Scanner;

public class WeaknessPoorness {

    public static final double ERR = 10e-7;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }

        double result = ternarySearch(a);
        System.out.println(result);
    }

    private static double ternarySearch(int[] a) {
        double min = -10000;
        double max = 10000;
        while (Math.abs(max - min) > ERR) {
            double m1 = min + (max - min) / 3;
            double m2 = min + 2 * (max - min) / 3;
            double w1 = weakness(a, m1);
            double w2 = weakness(a, m2);
            if (w1 < w2) {
                max = m2;
            } else {
                min = m1;
            }
        }

        return weakness(a, (max + min) / 2);
    }

    private static double weakness(int[] a, double x) {
        double maxSum = Integer.MIN_VALUE;
        double minSum = Integer.MAX_VALUE;

//        double curMax = 0;
//        double curMin = 0;
        BigDecimal curMax = new BigDecimal(0);
        BigDecimal curMin= new BigDecimal(0);
        for (int anA : a) {
            BigDecimal num = new BigDecimal(anA - x);
            curMax.add(num);
            curMin.add(num);
            if (curMax.doubleValue() > maxSum) {
                maxSum = curMax.doubleValue();
            }
            if (curMin.doubleValue() < minSum) {
                minSum = curMin.doubleValue();
            }
            if (curMax.doubleValue() < 0) {
                curMax = BigDecimal.ZERO;
            }
            if (curMin.doubleValue() > 0) {
                curMin = BigDecimal.ZERO;
            }
        }
        return Math.max(Math.abs(minSum), Math.abs(maxSum));
    }
}
