Official

F - Random Max Editorial by evima


There are two ways to solve this problem; either of which requires integrating polynomials. It is good idea to prepare the procedures of multiplying by \(ax + b\), differentiating, integrating, and assigning \(x\) a specific number of polynomials.

First, we can simplify the problem by splitting the possible range of random variable into \(O(N)\) subsegments so that each subsegment is either completely included in or disjoint with each of the \(N\) given subsegments. This can be achieved by sorting all the given \(2N\) values beforehand.

Let us explain how to find the (fragment of) expected value that correspond to a subsegment \([P, Q)\) (obtained by the process above). The desired answer can be found by summing them up and multiplying it by \((N+1)! \times (\)the product of lengths of segments\()\).

Solution \(1\)

Let us consider the case where a value \(x\) in the segment \([P, Q)\) is the maximum value. If \(max L ≤ Q\) is not satisfied, \(x\), which is in the range \([P, Q)\), can never be the maximum value.

Otherwise, the probability where all the random values becomes less than or equal to \(x\) is \(f(x) = \prod_{R_i ≥ P} \frac{x-L_i}{R_i-L_i}\).

Since the probability where the maximum is within \([x, x+dx)\) is \(f(x+dx)-f(x)\), so by \(dx \rightarrow 0\), the desired expected value is \(\int_P^Q xf'(x)dx\).

Solution \(2\)

Let \(g(x) := (\) The probability where the maximum value is more than or equal to \(x)\), then \(\int_0^{+∞} g(x)dx\). (Note the beginning of the integral!)

When \(x ≤ max L\), \(g(x) = 1\) always holds.

Otherwise, \(g(x) = 1 - \prod_{R_i ≥ P} \frac{x-L_i}{R_i-L_i}\).

posted:
last update: