QOJ.ac

QOJ

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

#10656. Sad

统计

年迈的巴伊塔扎尔拥有一片果园,里面长着结出纯金果实的苹果树。不幸的是,果园的工作非常辛苦,而巴伊塔扎尔已不像从前那样有力气,于是他决定将自己的果园分成若干块地,交给自己的儿子们耕作。巴伊塔扎尔希望每个儿子都能过上富足的生活,因此希望每个人分到的地里至少有一棵珍贵的苹果树。

巴伊塔扎尔的果园是一个 $n \times n$ 米的正方形。为方便起见,我们在其中建立了一个矩形坐标系,果园的左下角坐标为 $(0, 0)$,右上角坐标为 $(n, n)$。我们知道果园的哪些单位正方形内种有苹果树。分割后形成的地块应当是以坐标系网格线为边的矩形。各地块不能重叠——它们只能通过边或顶点相邻——且必须覆盖整个果园。地块的尺寸没有要求;唯一的要求是每块地里至少要有一棵苹果树。

你可以假设要求的分割一定是存在的。

输入格式

输入的第一行包含两个整数 $n$ 和 $k$($1 \le n \le 1\,000$, $1 \le k \le n^{2}$),分别表示果园的边长和巴伊塔扎尔的儿子数。接下来的 $n$ 行描述了果园中每个单位方格的情况。每行包含 $n$ 个字符,x 表示该格子里有苹果树,. 表示该格子里没有苹果树。

输出格式

你的程序应输出 $k$ 行,描述果园分成的每块地。每行输出四个整数 $x_{1}$, $y_{1}$, $x_{2}$, $y_{2}$,表示该地块的左下角顶点 $(x_{1}, y_{1})$ 和右上角顶点 $(x_{2}, y_{2})$ 的坐标。各块地的输出顺序无关紧要——巴伊塔扎尔自己会知道要把哪块地分给哪个儿子。

样例

输入

6 5
..x..x
..x...
....x.
xx.x.x
......
......

输出

0 0 3 4
0 4 5 5
5 4 6 6
3 0 6 4
0 5 5 6
problem_10656_1.gif?
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.