BubbleExtrema
[p]Let’s define a function f as
f(x [1],…,x [n])= a [1] x[1] + ... + a[n] x [n],
where a [i]∈[0,1] and a [1] + ... + a [n] = 1.
Given two points X and Y from R^n and value f(X)=C, find minimum and maximum value for f(Y).
Input:
[c]3
0 2 1
0 0 1
0.75
Output:
f(x [1],…,x [n])= a [1] x[1] + ... + a[n] x [n],
where a [i]∈[0,1] and a [1] + ... + a [n] = 1.
Given two points X and Y from R^n and value f(X)=C, find minimum and maximum value for f(Y).
Input The first line of input contains the number n (1≤n≤100.000). The second line contains numbers x [1],…,x [n] separated by a space. The third line contains y[1],…,y[n]. The final line contains the number [
]. It is guaranteed that there will always be coefficients a [i for which f(X)=C satisfying the above conditions. Output The first line of output should contain minimum value for f(Y) rounded to two decimal places, and the second line should contain the maximum value for f(Y), also rounded to two decimal places.
Input:
[c]3
0 2 1
0 0 1
0.75
Output:
0.00
0.75Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.