P3474 [POI 2008] KUP-Plot purchase

题目描述

Byteasar is going to buy an industrial plot. His fortune is estimated at $k$ bythalers and this is exactly the amount Byteasar would like to spend on the parcel. Finding a parcel worth exactly $k$ bythalers, however, is not an easy task. For this reason Byteasar is ready to buy a more expensive plot. He considers taking out a loan. The Byteotian Credit Bank will grant him a loan of up to $k$ bythalers. Thus, Byteasar can spend no more than $2k$ bythalers on the parcel and he would like to spend no less than $k$ bythalers. The area in which Byteasar wants to buy his parcel is a square with side length of $n$ metres. The current landlords have set up various prices per square metre. Byteasar has spoken to each one of them and has then prepared a price map of the area. The map depicts the price of every metre by metre square. Clearly, there are $n^2$ such squares. Now is the time to find the dream parcel. It has to be rectangular and consist of whole unit squares. Byteasar has already started looking for the plot on the map, but after many hours he was still unable to find a suitable one. Be a chap and help him! Write a programme that: reads the numbers $k$ and $n$ from the standard input, along with the price map of the area, determines a parcel with price in the interval $[k,2k]$ or states that no such parcel exists, writes out the result to the standard output.

输入格式

输出格式

说明/提示

给定 $k,n$ 和 $n\times n$ 的矩阵,求一个子矩形满足权值和在 $[k,2k]$ 之间。 $n