CF838E.Convex Countour

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You are given an strictly convex polygon with nn vertices. It is guaranteed that no three points are collinear. You would like to take a maximum non intersecting path on the polygon vertices that visits each point at most once.

More specifically your path can be represented as some sequence of distinct polygon vertices. Your path is the straight line segments between adjacent vertices in order. These segments are not allowed to touch or intersect each other except at the vertices in your sequence.

Given the polygon, print the maximum length non-intersecting path that visits each point at most once.

输入格式

The first line of input will contain a single integer nn ( 2<=n<=25002<=n<=2500 ), the number of points.

The next nn lines will contain two integers xi,yix_{i},y_{i} ( xi,yi<=109|x_{i}|,|y_{i}|<=10^{9} ), denoting the coordinates of the ii -th vertex.

It is guaranteed that these points are listed in clockwise order.

输出格式

Print a single floating point number, representing the longest non-intersecting path that visits the vertices at most once.

Your answer will be accepted if it has absolute or relative error at most 10910^{-9} . More specifically, if your answer is aa and the jury answer is bb , your answer will be accepted if .

输入输出样例

  • 输入#1

    4
    0 0
    0 1
    1 1
    1 0
    

    输出#1

    3.4142135624
    

说明/提示

One optimal path is to visit points 0,1,3,2 in order.

首页