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)

fn main() {
    let mut sc = cin();

    let mut binom = [[0; 60]; 60];
    for i in 0..60 {
        for j in 0..60 {
            binom[i][j] = if j == 0 {
                1
            } else if i < j {
                0
            } else {
                binom[i-1][j-1] + binom[i-1][j]
            }
        }
    }

    while sc.read() {
        let n = sc.next();
        let a: usize = sc.next();
        let b: usize = sc.next();
        let mut v = sc.vec::<i64>(n);
        v.sort();
        v.reverse();
        let mut max_ave: f64 = 0.0;
        for k in a..b+1 {
            let sum: i64 = v.iter().take(k).sum();
            let ave = sum as f64 / k as f64;
            if max_ave < ave {
                max_ave = ave;
            }
        }

        println!("{:.10}", max_ave);
        let mut cnt: Vec<(usize, _)> = vec![];
        for &x in v.iter() {
            if cnt.len() == 0 || cnt.last().unwrap().1 != x {
                cnt.push((1, x));
            } else {
                cnt.last_mut().unwrap().0 += 1;
            }
        }

        let mut ans = 0u64;
        for k in a..b+1 {
            let sum: i64 = v.iter().take(k).sum();
            let ave = sum as f64 / k as f64;
            if ave != max_ave {
                continue;
            }
            let mut cur = 0;
            let mut x = 1u64;
            for &(a, _) in cnt.iter() {
                if cur <= k && k <= cur + a {
                    x *= binom[a][k - cur];
                    // println!("binom {} {}", a, k-cur);
                }
                cur += a;
            }
            ans += x;
        }
        println!("{}", ans);
    }
}

#[allow(dead_code)]
fn cin() -> Scanner<std::io::Stdin> {
    Scanner::new(std::io::stdin())
}

#[allow(dead_code)]
pub struct Scanner<T> {
    buf: Vec<u8>,
    len: usize,
    idx: usize,
    next: Option<String>,
    reader: T,
}

#[allow(dead_code)]
impl<Reader: std::io::Read> Scanner<Reader> {
    fn new(r: Reader) -> Scanner<Reader> {
        Scanner {
            buf: vec![0; 8192],
            len: 0,
            idx: 0,
            next: None,
            reader: r,
        }
    }

    fn next<T: std::str::FromStr>(&mut self) -> T {
        self.wrapped::<T>().unwrap()
    }

    fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.next()).collect()
    }

    fn mat<T: std::str::FromStr>(&mut self, r: usize, c: usize) -> Vec<Vec<T>> {
        (0..r).map(|_| self.vec(c)).collect()
    }

    fn vec_char(&mut self) -> Vec<char> {
        self.read();
        self.next.take().unwrap().chars().collect()
    }

    fn mat_char(&mut self, r: usize) -> Vec<Vec<char>> {
        (0..r).map(|_| self.vec_char()).collect()
    }

    fn wrapped<T: std::str::FromStr>(&mut self) -> Option<T> {
        self.read();
        self.next.take().and_then(|s| s.parse::<T>().ok())
    }

    fn read(&mut self) -> bool {
        if self.next.is_some() {
            return true;
        }
        let mut s = String::with_capacity(16);
        while let Some(c) = self.get_char() {
            if !c.is_whitespace() {
                s.push(c);
            } else if !s.is_empty() {
                break;
            }
        }
        self.next = if !s.is_empty() { Some(s) } else { None };
        self.next.is_some()
    }

    fn get_char(&mut self) -> Option<char> {
        if self.idx == self.len {
            match self.reader.read(&mut self.buf[..]) {
                Ok(l) if l > 0 => {
                    self.idx = 0;
                    self.len = l;
                }
                _ => return None,
            }
        }
        self.idx += 1;
        Some(self.buf[self.idx - 1] as char)
    }
}