SP1878 FCATTLE - Farmers Cattle

Description

Farmer john owns a single cow and he loves it a lot. The cow has a disease and is going to die. To survive, the cow needs medicine of a particular type each day. Let us say the cow needs **medicine**\[i\] to survive the i $ ^{th} $ day. (medicine\[i\] will be terminated by -1, which is an unavailable medicine, and the cow has to invariably die that day). To help the cow, john has decided to buy pastures of some medical value. Farmer sees a two-dimensional grid of pastures, each cell having exactly one medical herb. Now he needs to buy a sub-rectangular region of the grid, whose area cannot exceed **A** (**A** > 1). With this region the farmer intends to feed his cow, as long as possible. **Input Format:** The input file consists of multiple testcases. The first line of each testcase contains three integers, **R**, **C** and **A**. The second line consists of sequence of integers describing **medicine**\[i\]. This list will be terminated by -1. The next **R** lines contain **C** integers each, specifying the medicinal type of the herb in that cell. (1

Input Format

N/A

Output Format

N/A