QOJ.ac

QOJ

時間限制: 2 s 記憶體限制: 256 MB 總分: 100

#13834. Watchtower

统计

To build a model harmonious village, Village Chief dadzhi of Village H has decided to build an observation tower to strengthen security in the village.

We can represent Village H as a one-dimensional profile. As shown in the figure below:

We can describe the shape of Village H using a polyline of the upper mountain profile $(x_1, y_1), (x_2, y_2), \dots, (x_n, y_n)$, where $x_1 < x_2 < \dots < x_n$. The observation tower can be built at any position between $[x_1, x_n]$, but it must be tall enough so that every point in Village H is visible from the top of the tower. It is evident that the required height of the tower varies depending on its location. To save costs, Chief dadzhi wants to minimize the height of the tower.

Please write a program to help Chief dadzhi calculate the minimum height of the tower.

Input

The first line contains an integer $n$, representing the number of nodes in the profile polyline. The next line contains $n$ integers, $x_1 \sim x_n$. The third line contains $n$ integers, $y_1 \sim y_n$.

Output

Output a single real number representing the minimum height of the tower, rounded to three decimal places.

Constraints

For 60% of the data, $N \le 60$. For 100% of the data, $N \le 300$. The absolute values of the input coordinates do not exceed $10^6$. Be careful to consider issues caused by floating-point errors.

Examples

Input 1

6
1 2 4 5 6 7
1 2 2 4 2 1

Output 1

1.000

Input 2

4
10 20 49 59
0 10 10 0

Output 2

14.500

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.