def spearman_squared_distance(r_1, r_2):
    """
    Computes a weighted Spearman's Rho squared distance. Runs in O(n)

    Args:
        r_1, r_2 (list): list of weighted rankings.
                       Index corresponds to an item and the value is the weight
                       Entries should be positive and sum to 1
                       Example: r_1 = [0.1, 0.2, 0.7]
    Returns: float >= representing the distance between the rankings
    """
    # confirm r_1 and r_2 have same lengths
    if len(r_1) != len(r_2):
        raise ValueError("rankings must contain the same number of elements")
    distance = 0

    for r_1_value, r_2_value in zip(r_1, r_2):
        order_penalty = (r_1_value - r_2_value)**2
        weight = r_1_value * r_2_value * 100 * 100
        distance += weight * order_penalty

    return distance