CF873C.Strange Game On Matrix

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Ivan is playing a strange game.

He has a matrix aa with nn rows and mm columns. Each element of the matrix is equal to either 00 or 11 . Rows and columns are 11 -indexed. Ivan can replace any number of ones in this matrix with zeroes. After that, his score in the game will be calculated as follows:

  1. Initially Ivan's score is 00 ;
  2. In each column, Ivan will find the topmost 11 (that is, if the current column is jj , then he will find minimum ii such that ai,j=1a_{i,j}=1 ). If there are no 11 's in the column, this column is skipped;
  3. Ivan will look at the next min(k,ni+1)min(k,n-i+1) elements in this column (starting from the element he found) and count the number of 11 's among these elements. This number will be added to his score.

Of course, Ivan wants to maximize his score in this strange game. Also he doesn't want to change many elements, so he will replace the minimum possible number of ones with zeroes. Help him to determine the maximum possible score he can get and the minimum possible number of replacements required to achieve that score.

输入格式

The first line contains three integer numbers nn , mm and kk ( 1<=k<=n<=1001<=k<=n<=100 , 1<=m<=1001<=m<=100 ).

Then nn lines follow, ii -th of them contains mm integer numbers — the elements of ii -th row of matrix aa . Each number is either 00 or 11 .

输出格式

Print two numbers: the maximum possible score Ivan can get and the minimum number of replacements required to get this score.

输入输出样例

  • 输入#1

    4 3 2
    0 1 0
    1 0 1
    0 1 0
    1 1 1
    

    输出#1

    4 1
    
  • 输入#2

    3 2 1
    1 0
    0 1
    0 0
    

    输出#2

    2 0
    

说明/提示

In the first example Ivan will replace the element a1,2a_{1,2} .

首页