PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GD0000054. Bơm bóng bay (Inflation)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Bơm bóng bay (Inflation)

Inflation

Source: Kattis

Version: Phuoc Hung OJ Extended

Problem Statement

There are nn balloons of capacities 1,2,…,n1,2,\ldots,n and nn gas canisters containing cic_i units. Pair each canister with one balloon and empty it entirely without overfilling any balloon. Maximize the minimum filling fraction.

Input

Line 1: nn. Line 2: nn gas quantities cic_i.

Output

Print impossible if no matching is feasible; otherwise print the optimal fraction with absolute or relative error at most 10−610^{-6}.

Subtasks

  • Subtask 1 (20 points): 1≤n≤51\le n\le 5; 0≤ci≤n0\le c_i\le n for every ii.
  • Subtask 2 (30 points): 1≤n≤30001\le n\le 3000; 0≤ci≤n0\le c_i\le n for every ii.
  • Subtask 3 (50 points): 1≤n≤2000001\le n\le 200000; 0≤ci≤n0\le c_i\le n for every ii.

Examples

Input

3
1 2 2

Output

0.666666666667

Explanation

Match 1 to balloon size 1 and the two 2-unit canisters to sizes 2 and 3. The fractions are 1,1,2/31,1,2/3, so the optimal minimum is 2/32/3.