Three View Drawing

AtCoder
IDarc175_e
Time2000ms
Memory256MB
Difficulty
> 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$ [samples]
Samples
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
API Response (JSON)
{
  "problem": {
    "name": "Three View Drawing",
    "description": {
      "content": "> 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 an",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "arc175_e"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "> 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 an...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments