Task DescriptionDiscussion (0)
Task :: 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:
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 C. It is guaranteed that there will always be coefficients a [i for which f(X)=C satisfying the above conditions.
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 C. 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.
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:
3
0 2 1
0 0 1
0.75
0 2 1
0 0 1
0.75
Output:
0.00
0.75
0.75
Submit Solution
Available Languages
Task info
| Name: | BubbleExtrema |
| Time: | 0.5 sec. |
| Memory: | 128 MB |
| #Tests: | 18 |
| AddedBy: | andrejko |
| Source: | Bubble Cup Finals 2010 |
Task Ratings
| Difficulty: | 4.7 (3 votes) |
| Quality: | 5 (3 votes) |
Acceptance Rate
Recent Submissions
Fastest Solutions
| User | Time |
|---|---|
| halil | 2.37 s. |
| picsel | 2.85 s. |
| PetarV | 3.48 s. |
| oduleodule | 3.63 s. |
Solved By
Home
Training
Competitions
Forum
FAQ