Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register
Language:
Min-Max
Time Limit: 1000MSMemory Limit: 65536K
Total Submissions: 2549Accepted: 573

Description

Define the following function

Given the value C of F(p1, p2 ... pn), can you find the minimum and maximum value of F(q1, q2 ... qn)?

Input

The input contains several test cases. For each test case, it contains three lines.

Line 1: two integers n (1<= n <= 50000) and C.
Line 2: n integers p1, p2 ... pn (|pi| < 1000 for 1 <= i <= n).
Line 3: n integers q1, q2 ... qn (|qi| < 1000 for 1 <= i <= n).

Output

For each test case, output the minimum and maximum value in a single line with the fraction rounded to 3 decimal places.

Sample Input

2 1
3 1
0 2

Sample Output

2.000 2.000

Source

[Submit]   [Go Back]   [Status]   [Discuss]

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator