Mine country 404
Limits: 2 sec., 256 MiB
This statement was translated automatically from Ukrainian.
Pay attention to the unusual constraints.
To increase security, the Armed Forces of Ukraine decided to mine the border with country 404. For this, the border was conditionally divided into different parts, and responsibility for each part was assigned to different people. One of the parts went to Petryk.
Field that Petryk has to mine is a rectangle of size \(n \times m\) divided into cells of size \(1 \times 1\). Petryk can place a mine in each of the cells with integer coordinates \((x, y)\). Then all cells with coordinates \((u, v)\) for which \(|x - u| + |y - v| \le 1\) hold are considered mined. In other words, a cell is considered mined if a mine is placed in it or in one of its vertical or horizontal neighbors.
War is an expensive business, and therefore it is important to act efficiently. A cell is considered good if it is mined, but no mine is placed in it. The field is considered efficiently mined if at least \(77.4\%\) of the cells are good. Help Petryk find an efficient mining of the field.
Input
The single line contains two integers \(n\) and \(m\) — the sizes of the field.
Output
In \(n\) lines print a matrix of
size \(n \times m\) consisting of
characters . and x. The character
. denotes an empty cell. The character x
denotes a cell with a placed mine. The printed matrix must correspond to
an efficient mining of the field.
It is guaranteed that the answer always exists under the given constraints.
Constraints
\(47 \le n, m \le 500\),
Samples
| Input (stdin) | Output (stdout) |
|---|---|
| 5 5 | .x.x. ..... x.x.x ..... .x.x. |
Notes
Pay attention! The values of \(n\) and \(m\) given in the example do not match the constraints of the problem. Also, the answer shown in the example does not correspond to an efficient mining of the field.
Visualization of the answer from the example is shown in the figure below. It shows a field of size \(5 \times 5\) — a total of 25 cells. Of these, 7 contain a mine (marked in blue), 18 are mined but do not contain a mine (marked in green), and 0 cells are not mined. Thus only \(18 / 25 \cdot 100\% = 72\%\) of the cells are good, which does not satisfy the problem condition. It can be shown that a field of size \(5 \times 5\) cannot be efficiently mined.
Submit a solution
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|