Codeforces Round 291 (Div. 2)
D
R2D2 and Droid Army
Codeforces
2000
原题
← CE →
翻译中…

An army of $*n*$ droids is lined up in one row. Each droid is described by $*m*$ integers $*a*_{1}, *a*_{2}, ..., *a*_{*m*}$, where $*a*_{*i*}$ is the number of details of the $*i*$-th type in this droid's mechanism. R2-D2 wants to destroy the sequence of consecutive droids of maximum length. He has $*m*$ weapons, the $*i*$-th weapon can affect all the droids in the army by destroying one detail of the $*i*$-th type (if the droid doesn't have details of this type, nothing happens to it).

翻译中…

A droid is considered to be destroyed when all of its details are destroyed. R2-D2 can make at most $*k*$ shots. How many shots from the weapon of what type should R2-D2 make to destroy the sequence of consecutive droids of maximum length?

翻译中…

Input

翻译中…

The first line contains three integers $*n*, *m*, *k*$ ($1 ≤ *n* ≤ 10^{5}$, $1 ≤ *m* ≤ 5$, $0 ≤ *k* ≤ 10^{9}$) — the number of droids, the number of detail types and the number of available shots, respectively.

翻译中…

Next $*n*$ lines follow describing the droids. Each line contains $*m*$ integers $*a*_{1}, *a*_{2}, ..., *a*_{*m*}$ ($0 ≤ *a*_{*i*} ≤ 10^{8}$), where $*a*_{*i*}$ is the number of details of the $*i*$-th type for the respective robot.

翻译中…

Output

翻译中…

Print $*m*$ space-separated integers, where the $*i*$-th number is the number of shots from the weapon of the $*i*$-th type that the robot should make to destroy the subsequence of consecutive droids of the maximum length.

翻译中…

If there are multiple optimal solutions, print any of them.

翻译中…

It is not necessary to make exactly $*k*$ shots, the number of shots can be less.

翻译中…

Note

翻译中…

In the first test the second, third and fourth droids will be destroyed.

翻译中…

In the second test the first and second droids will be destroyed.

翻译中…

样例

Input #1
5 2 4
4 0
1 2
2 1
0 2
1 3
Output #1
2 2
InputCopy OutputCopy
Input #2
3 2 4
1 2
1 3
2 2
Output #2
1 3
InputCopy OutputCopy
题目信息
题号
514D
时间限制
2 s
内存限制
256 MB
标签
二分
数据结构
双指针

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。