This page is still under construction.

Parts of this page are still being built. What you see may change.

Yes or No?

Interview

Time limit1sMemory limit128 MB

Summary
Pick between l and r questions to answer Yes, maximizing the sum of per-question expected correct probabilities, and report the maximum expectation to two decimals.
Level

Medium5 of 10

Topics
Dynamic programming, Sorting, Greedy, Probability
Solved
No attempts yet

Problem

Multiple-choice tests are easy to grade, so they are popular with some teachers. The simplest form is the true/false, or yes/no, question.

You are taking a yes/no test. For each question you have an a priori estimate of how likely each answer is to be correct. For question ii you believe the answer is “Yes” with probability yiy_i and “No” with probability 1−yi1 - y_i.

If the questions were independent you would simply pick whichever of yiy_i and 1−yi1 - y_i is larger. However, this teacher dislikes a lopsided answer key, and you know that the number of “Yes” answers is always between ℓ\ell and rr inclusive, for some ℓ≤r\ell \le r.

You must therefore decide which questions to answer “Yes” — answering “Yes” at least ℓ\ell times and at most rr times — so as to maximize the expected number of questions you get right. Output that maximum expected number of correct answers.

Input

The first line contains the number of data sets K≥1K \ge 1. Then follow KK data sets of the following form.

The first line of each data set contains three integers ℓ≤r≤n\ell \le r \le n, where n≤200n \le 200 is the total number of questions, ℓ\ell is the minimum number of questions answered “Yes”, and rr is the maximum.

This is followed by nn lines, each containing one fractional number yi∈[0,1]y_i \in [0, 1] for the corresponding question ii.

Output

For each data set, first output Data Set x: on a line by itself, where xx is its number. Then output the maximum expected number of questions you can get right subject to all the constraints, rounded to two decimals.

Examples2

  1. Example 1

    Input
    1
    2 4 5
    0.2
    0.4
    0.35
    0.8
    0.4
    
    Expected output
    Data Set 1:
    3.25
    
  2. Example 2

    Input
    2
    2 4 5
    0.2
    0.4
    0.35
    0.8
    0.4
    1 1 1
    0.9
    
    Expected output
    Data Set 1:
    3.25
    Data Set 2:
    0.90