Walktober

아직 제출이 없습니다메모리 제한1024 MB

문제

John participates in an annual walking competition called Walktober. The competition runs for a total of N\mathbf{N} days and tracks the daily steps of the participants for all the N\mathbf{N} days. Each participant will be assigned a unique ID ranging from 11 to M\mathbf{M} where M\mathbf{M} is the total number of registered participants. A global scoreboard is maintained tracking the daily steps of each participant.

John is determined to win Walktober this year and his goal is to score the maximum daily steps on each of the N\mathbf{N} days among all the participants. Having participated in Walktober last year as well, he wanted to know how many steps he fell short of in achieving his goal. Given the previous year scoreboard, calculate the minimum additional steps he needed over his last year score in order to achieve his goal of scoring the maximum daily steps every day.

입력

The first line of the input gives the number of test cases, T\mathbf{T}. T\mathbf{T} test cases follow.

The first line of each test case contains three integers M\mathbf{M}, N\mathbf{N}, and P\mathbf{P} denoting the total number of participants, the total number of days the competition runs, and the last year participant ID of John.

The next M\mathbf{M} lines describe the scoreboard of the previous year and contains N\mathbf{N} integers each. The jj-th integer of the ii-th line denotes the step count S_i,j\mathbf{S\_{i,j}} of the participant with ID ii on the jj-th day of the competition.

출력

For each test case, output one line containing Case #x: y, where xx is the test case number (starting from 1) and yy is the minimum total additional steps needed by John to achieve his goal.

제한

  • 1T1001 \le \mathbf{T} \le 100.
  • 1N311 \le \mathbf{N} \le 31.
  • 1S_i,j600001 \le \mathbf{S\_{i,j}} \le 60000 for all ii and jj.
  • 1PM1 \le \mathbf{P} \le \mathbf{M}.