Under construction

Still being built. Things may change

Airport Construction

Time limit2sMemory limit512 MB

Summary
Given a simple polygon with up to 200 vertices, find the longest line segment that lies entirely inside it.
Level

Hard8 of 10

Topics
Geometry, Brute force, Implementation
Solved
No attempts yet

Problem

The tropical island nation of Piconesia is known for its beaches, its forests, its cocoa and coffee plantations, and good weather all year round. It has one problem: the island is very hard to reach.

Today the fastest trip from the nearest airport takes three days and uses a fishing boat, an oil tanker, a kayak, and a submarine. To start a tourism business, Piconesia is going to build its first airport.

A longer landing strip takes larger airplanes, so Piconesia wants the longest landing strip that fits on the island. Nobody has worked out where to put it.

In this problem the coastline of the island is a polygon. Given the polygon, compute the length of the longest straight landing strip that can be built on the island. The landing strip must not cross the sea, but it may touch the boundary of the island or run along it.

Figure: the island drawn as a polygon. The thick line is the longest landing strip for the first example.

Input

The first line contains the number of vertices of the polygon nn (3≤n≤2003 \le n \le 200).

Each of the next nn lines contains the coordinates xx and yy (∣x∣,∣y∣≤106|x|, |y| \le 10^6) of one vertex, in counter-clockwise order. Both coordinates are integers.

The polygon is simple. All vertices are distinct, and no two edges intersect or touch, except that consecutive edges touch at their common vertex. No two consecutive edges lie on one line.

Output

Print the length of the longest line segment that fits inside the polygon on one line, rounded to six digits after the decimal point. Always print all six digits, even when they are zeros.

Examples2

  1. Example 1

    Input
    7
    0 20
    40 0
    40 20
    70 50
    50 70
    30 50
    0 50
    
    Expected output
    76.157731
    
  2. Example 2

    Input
    3
    0 2017
    -2017 -2017
    2017 0
    
    Expected output
    4510.149111