QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 128 MB Total points: 100

#15156. Maximum Submatrix

Statistics

You are given an $n \times m$ matrix. Please select $k$ submatrices from it such that the sum of the values of these $k$ submatrices is maximized. Note: The selected $k$ submatrices must not overlap.

Input

The first line contains $n, m, k$ ($1 \le n \le 100, 1 \le m \le 2, 1 \le k \le 10$). The next $n$ lines describe the values of each element in each row of the matrix (the absolute value of each element does not exceed $32767$).

Output

A single line containing the maximum sum of the values of the $k$ submatrices.

Examples

Input 1

3 2 2
1 -3
2 3
-2 3

Output 1

9

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.