Mock CCO '19 Contest 2 Problem 5 - A Geometry Problem

View as PDF

Submit solution

Points: 12 (partial)
Time limit: 0.6s
Memory limit: 162M

Problem type

You are given a polyline (x1,y1) through (xN,yN). Compute the minimum length of a vertical segment (parallel to the y-axis) with its bottom endpoint somewhere on the polyline such that from every point on the polyline, the segment is at least partially visible.

Constraints

1N300

|xi|,|yi|106

Input Specification

The first line contains a single integer, N.

The next line contains N space-separated integers, the ith being xi. These will be presented in increasing order.

The next line contains N space-separated integers, the ith being yi.

Output Specification

Output the desired length to exactly three decimal places.

Sample Input

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

Sample Output

Copy
1.000

Comments

There are no comments at the moment.