星座AI (CI翻译)
A star map in Berland is a checked field $*n* × *m*$ squares. In each square there is or there is not a star. The favourite constellation of all Berland's astronomers is the constellation of the Cross. This constellation can be formed by any 5 stars so, that for some integer $*x*$ (radius of the constellation) the following is true:
- the 2nd is on the same vertical line as the 1st, but
$*x*$squares up - the 3rd is on the same vertical line as the 1st, but
$*x*$squares down - the 4th is on the same horizontal line as the 1st, but
$*x*$squares left - the 5th is on the same horizontal line as the 1st, but
$*x*$squares right
Such constellations can be very numerous, that's why they are numbered with integers from 1 on the following principle: when two constellations are compared, the one with a smaller radius gets a smaller index; if their radii are equal — the one, whose central star if higher than the central star of the other one; if their central stars are at the same level — the one, whose central star is to the left of the central star of the other one.
Your task is to find the constellation with index $*k*$ by the given Berland's star map.
Input
输入格式
AI (CI翻译)The first line contains three integers $*n*$, $*m*$ and $*k*$ ($1 ≤ *n*, *m* ≤ 300, 1 ≤ *k* ≤ 3·10^{7}$) — height and width of the map and index of the required constellation respectively. The upper-left corner has coordinates $(1, 1)$, and the lower-right — $(*n*, *m*)$. Then there follow $*n*$ lines, $*m*$ characters each — description of the map. $*j*$-th character in $*i*$-th line is «*», if there is a star in the corresponding square, and «.» if this square is empty.
第一行包含三个整数 $*n*$、$*m*$ 和 $*k*$($1 ≤ *n*, *m* ≤ 300$,$1 ≤ *k* ≤ 3·10^{7}$),分别表示星图的高度、宽度以及所需星座的编号。左上角的坐标为 $(1, 1)$,右下角的坐标为 $(*n*, *m*)$。接下来有 $*n*$ 行,每行包含 $*m*$ 个字符,表示星图。第 $*i*$ 行的第 $*j*$ 个字符为 «*»,表示对应方格中有一颗星;若该字符为 «.»,则表示该方格为空。AI (CI翻译)
Output
输出格式
AI (CI翻译)If the number of the constellations is less than $*k*$, output -1. Otherwise output 5 lines, two integers each — coordinates of the required constellation. Output the stars in the following order: central, upper, lower, left, right.
如果星座总数少于 $*k*$,输出 -1。否则输出 5 行,每行包含两个整数,表示所需星座中各颗星的坐标。按以下顺序输出这些星星:中心、上、下、左、右。
AI (CI翻译)
样例
5 6 1
....*.
...***
....*.
..*...
.***..
2 5
1 5
3 5
2 4
2 6
5 6 2
....*.
...***
....*.
..*...
.***..
-1
7 7 2
...*...
.......
...*...
*.***.*
...*...
.......
...*...
4 4
1 4
7 4
4 1
4 7
题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。