Under construction

Still being built. Things may change

Pie

Time limit1sMemory limit128 MB

Summary
Given N cylindrical pies, find the maximum piece volume so that F+1 equal-sized pieces can be cut from the pies, using binary search on the answer.
Level

Medium5 of 10

Topics
Binary search, Math, Greedy
Solved
No attempts yet

Problem

My birthday is coming up, and by tradition I serve pie. Not just one pie — I have NN of them, of various tastes and sizes. FF friends are coming to the party, and each of them gets one piece of pie. To keep things tidy this must be a single piece cut from one pie, not several small pieces, though a whole pie may count as one piece.

My friends are picky: if anyone gets a bigger piece than the others, they start complaining. So everyone must get an equally sized piece (the shapes may differ), even if this means some pie is wasted. Of course I want a piece for myself too, and it must be the same size.

Every pie is a cylinder of the same height 11, but the radii rir_i may differ. What is the largest volume of piece that I and all of my friends can each get?

Input

The first line contains a positive integer: the number of test cases. Then, for each test case:

  • One line with two integers NN and FF (1≤N,F≤100001 \le N, F \le 10000): the number of pies and the number of friends.
  • One line with NN integers rir_i (1≤ri≤100001 \le r_i \le 10000): the radii of the pies.

Output

For each test case, output on one line the largest volume VV such that I and all of my friends can each get a piece of size VV, rounded to exactly four decimal places. (The original problem allows any real number within an absolute error of 10−310^{-3}; for automatic judging the answer is printed with a fixed four-decimal format.)

Examples1

  1. Example 1

    Input
    3
    3 3
    4 3 3
    1 24
    5
    10 5
    1 4 2 3 4 5 6 5 4 2
    
    Expected output
    25.1327
    3.1416
    50.2655