Server Overload
시간 제한2초메모리 제한1024 MB
n x n 격자에서 서로 겹치지 않는 가로 1x3 구간을 최대 k개 골라 덮인 칸의 합이 최대가 되도록 한다.
문제
The IT team of a SY company manages the sever log data. This log data is organized into an grid, with each cell storing a number indicating the server access count during a specific time period. The server has recently been overloaded and is at risk of going down. To determine the cause of the server overload, the IT team uses a specialized analysis tool to find the sub-grids of grid that represent the high access counts. The analysis tool covers some sub-grid (of the grid) of vertical length of and of horizontal length of . The tool reports the sum of access counts stored in the cells of the sub-grid that the tool covers. The only limitation is that you can use this analysis tool at most times and the sub-grids covered by the tool should not overlap.
Given an grid and a positive integer , write a program that outputs the maximum of the total sum of access counts stored in cells of the grid covered by the analysis tool, such that the tool is used at most times and no sub-grids covered by the tool overlap.
입력
Your program is to read from standard input. The input starts with a line containing two integers, and (, ), where represents the size of the grid and is the maximum number of times that the analysis tool can be used. In the following lines, access count values of the grid are given; the -th line contains access count values (from the first column to the last column) of the -th row of the grid. All these access count values are integers between and .
출력
Your program is to write to standard output. Print exactly one line. The line should contain the maximum of the total sum of access counts in cells covered by the analysis tool such that the tool can be used at most times and no sub-grids covered by the tool overlap.