Mike and Matrix Game

4.8

4 votes
Combinatorics, Medium, Probability, Statistics
Problem

Mike and Harvey are back together! To celebrate this special occasion, they decided to play a unique game. So, this is how it goes :

Mike gives Harvey an grid A containing integers and 2 integers K and X. Now, Harvey begins the game by selecting K distinct rows among the N rows. He will then add the integer X to all elements of the selected rows.

Mike will then write N integers on a piece of paper, where the integer denotes the maximum integer present in the column. He then tells Harvey the sum of all integers written on that piece of paper. Let's call this number Mike tells Harvey as Z

This is where your part comes in. Considering that Harvey selects each distinct tuple of K rows with equal probability, you are to find the Expected Value of Z. Can you do this ?

Your answer will be considered correct if the absolute OR relative error between your answer and the jury's answer is . More formally, let your answer be a and the jury's answer be b. Your solution will be considered correct if

Input Format :

The first line contains 3 space separated integers and X respectively.

Each of the next N lines contains N space separated integers, where the integer on the line denotes .

Output Format :

For each test case, print a single real number denoting the answer to the problem.

Constraints :

Sample Input
3 3 0
1 2 3
4 5 6
7 8 9
Sample Output
24.00000000000000000000
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

.

Editor Image

?