AtCoder Regular Contest 175
E
Three View Drawing
AtCoder
⌀ 3223
原题
← DF →
翻译中…

Problem Statement

翻译中…

Divide a cube with a side length of $N$ into $N^3$ smaller cubes, each with a side length of $1$, and select $K$ of these smaller cubes. Construct one way to select them so that, when viewed from any of the three directions perpendicular to the faces of the cubes, all $K$ selected cubes are visible and appear in the same shape.

翻译中…

To formulate the problem precisely, we associate each smaller cube after division with a triple of integers $(x_i, y_i, z_i)$.

翻译中…

Construct and print one set of $K$ triples of integers $(x_i, y_i, z_i)$ that satisfy the following conditions.

翻译中…
  • $0 \leq x_i, y_i, z_i < N$
  • $\left\lbrace (x_i, y_i) \, \middle| \, 1 \le i \le K \right\rbrace = \left\lbrace (y_i, z_i) \, \middle| \, 1 \le i \le K \right\rbrace = \left\lbrace (z_i, x_i) \, \middle| \, 1 \le i \le K \right\rbrace$
  • The set mentioned in the previous item has $K$ elements. That is, $(x_i, y_i) \neq (x_j, y_j)$ for $i \neq j$.
翻译中…

It can be shown that a solution exists for any input satisfying the constraints.

翻译中…

Constraints

翻译中…
  • All input values are integers.
  • $1 \leq N \leq 500$
  • $1 \leq K \leq N^2$
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

N K

翻译中…

Output

翻译中…

Print your answer in the following format:

翻译中…

x_1 y_1 z_1
x_2 y_2 z_2
\vdots
x_K y_K z_K

翻译中…

If multiple solutions exist, any of them will be accepted.

翻译中…

样例

Input #1
3 3
Output #1
0 0 0
1 1 1
2 2 2
Input #2
2 4
Output #2
0 0 1
0 1 0
1 0 0
1 1 1
Input #3
1 1
Output #3
0 0 0
题目信息
题号
arc175_e
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。