Gifts (+ monotonic binary answer queue)

QUESTION:
JYY and CX wedding anniversary coming, JYY Meng Meng came to commemorate the opening of the gift shop to buy gifts. Meng Meng's gift shop is amazing, all gifts are sold in a particular order are in a row, and there is a mysterious beauty between adjacent gift. So, JYY decided to pick and choose some continuous gift, but exactly what does the election? Gift Shop assume a total of \ (N \) gift in a row, each gift has its aesthetics. Ranked \ (I \) ( \ (. 1 \ Leq I \ Leq N \) ) the appearance of the present position is a positive integer \ (A_i \) . JYY decide which elected a continuous period of that numbered gift \ (i \) , \ (i + 1 \) , ...., \ (J-1 \) , \ (J \) gift. Aesthetic level selected these gifts is defined as:

(\(M(i,j)\)?\(m(i,j)\))\(\div\)\((j-i+k)\)

Wherein \ (M \) \ ((\) \ (I \) \ (, \) \ (J \) \ () \) represents \ (max \) { \ (A_i \) , \ (A_i +. 1 \ ) \ (, \) \ (.... \) \ (A_j \) }
\ (m \) \ ((\) \ (I \) \ (, \) \ (J \) \ () \) It represents \ (min \) { \ (A_i \) , \ (A_i. 1 + \) \ (, \) \ (.... \) \ (A_j \) } \ (, \) \ (K \) of given positive integer.

Since the gas can not be too small, so the \ (JYY \) \ (the \) number of pieces selected gifts minimum \ (L \) pieces; at the same time, the election is not easy to get too much, so the gift up to the election \ (R \) pieces. \ (JYY \) how to choose, to get the greatest degree of aesthetic? Because too many gifts Tiao, \ (JYY \) intend to put this matter to be programmed you.

Input Format

The title of each test point multiple sets of data.
Input of the first line contains a positive integer \ (T \) ( \ (T \ Leq 10 \) ), expressed \ (T \) set of data.
Each set of data consists of two rows.
The first row four non-negative integer \ (N \) , \ (K \) , \ (L \) , \ (R & lt \) ( \ (2 \ Leq L \ R & lt Leq \ Leq N \) ).
The second line contains N positive integers, respectively for \ (A_1, A_2 .... A_n \) ( \ (A_i \ Leq. 8 ^ 10 \) ) \ (N, K \ Leq 50,000 \)

Output Format

Output \ (T \) lines of a non-negative real number, successively each data corresponding to the answer, the answer data to ensure that no more than \ (10 ^ 3 \) . Output rounded to \ (4 \) decimal places.

Down \ (\ bigvee \)






































































































to continue






































































































coming






































































































50M






































































































40M






































































































30M






































































































20M






































































































10M






































































































XIBER !!!
answer:

Guess you like

Origin www.cnblogs.com/SZJZC/p/11407434.html