Problem:
Score : 400 points

Problem Statement

You are given N items.

The value of the i-th item (1 \leq i \leq N) is v_i.

Your have to select at least A and at most B of these items.

Under this condition, find the maximum possible arithmetic mean of the values of selected items.

Additionally, find the number of ways to select items so that the mean of the values of selected items is maximized.

Constraints

1 \leq N \leq 50

1 \leq A,B \leq N

1 \leq v_i \leq 10^{15}

Each v_i is an integer.

Input

The input is given from Standard Input in the following format:

N A B
v_1
v_2
...
v_N

Output

Print two lines.

The first line should contain the maximum possible arithmetic mean of the values of selected items. The output should be considered correct if the absolute or relative error is at most 10^{-6}.

The second line should contain the number of ways to select items so that the mean of the values of selected items is maximized.

Sample Input 1

5 2 2
1 2 3 4 5

Sample Output 1

4.500000
1

The mean of the values of selected items will be maximized when selecting the fourth and fifth items. Hence, the first line of the output should contain 4.5.

There is no other way to select items so that the mean of the values will be 4.5, and thus the second line of the output should contain 1.

Sample Input 2

4 2 3
10 20 10 10

Sample Output 2

15.000000
3

There can be multiple ways to select items so that the mean of the values will be maximized.

Sample Input 3

5 1 5
1000000000000000 999999999999999 999999999999998 999999999999997 999999999999996

Sample Output 3

1000000000000000.000000
1

Solution in Rust (1.15.1) (judge verdict: Wrong Answer)

use std::io;
use std::io::{BufRead, Stdin};
use std::str;
use std::str::FromStr;

fn main() -> () {
    let mut sc = Scanner::new();
    let n = sc.till_ws::<usize>();
    let a = sc.till_ws::<u32>();
    let b = sc.till_nl::<u32>();
    let v = {
        let mut v: Vec<u64> = Vec::new();
        for _ in 0..(n - 1) {
            v.push(sc.till_ws())
        }
        v.push(sc.till_nl());
        v.sort_by(|a, b| b.cmp(a));
        v
    };
    println!("{}", solve(n, a, b, v));
}

fn solve(n: usize, a: u32, b: u32, v: Vec<u64>) -> String {
    let mut duplicates: Vec<u32> = Vec::new();
    let mut sum = 0u64;
    let mut last_r = 0u64;
    let mut cmt = 0u32;
    for i in 0..a {
        let r = v[i as usize];
        sum += r;
        if r == last_r {
            cmt += 1;
        } else {
            if cmt > 0 {
                duplicates.push(cmt);
            }
            cmt = 0;
            last_r = r;
        }
    }
    String::from(format!("{}\n{}",
                         (sum as f64) / (a as f64),
                         duplicates.iter().fold(1, |x, y| x * y)))
}

struct Scanner {
    stdin: Stdin,
    buffer: Vec<u8>,
}

impl Scanner {
    fn new() -> Scanner {
        Scanner {
            stdin: io::stdin(),
            buffer: Vec::with_capacity(1024),
        }
    }

    fn till<T: FromStr + Default>(&mut self, c: u8) -> T {
        self.buffer.clear();
        let n = self.stdin
            .lock()
            .read_until(c, &mut self.buffer)
            .unwrap() - 1;
        self.buffer.pop();
        str::from_utf8(&self.buffer[0..n]).unwrap().parse::<T>().unwrap_or(T::default())
    }

    fn till_ws<T: FromStr + Default>(&mut self) -> T {
        self.till(' ' as u8)
    }

    fn till_nl<T: FromStr + Default>(&mut self) -> T {
        self.till('\n' as u8)
    }
}