Find the Maximum
题号:NC236495
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
Special Judge, 64bit IO Format: %lld

题目描述

A tree with  vertices is a connected undirected graph with  vertices and  edges.

You are given a tree with  vertices. Each vertex has a value . Note that for any two vertices there is exactly one single path between them, whereas a simple path doesn't contain any edge more than once. The length of a simple path is considered as the number of edges in it.

You need to pick up a simple path whose length is not smaller than  and select a real number . Let  be the set of vertices in the simple path. You need to calculate the maximum of .

输入描述:

The first line contains a single integer  (), indicating the number of vertices in the tree.

The second line contains  integers  (), indicating the values of each vertex.

Each line in the next  lines contains two integers , indicating an edge in the tree.

输出描述:

The output contains a single real number, indicating the answer.

Your answer will be accepted if and only if the absolute error between your answer and the correct answer is not greater than .

示例1

输入

复制
2
3 2
1 2

输出

复制
1.562500