P12606 B. Car Crashing Challenge

Background

The problem background is not important.

Description

You are given integers $n$, $m$, and $k$. Your task is to construct $k$ tuples $(x_{i,1},x_{i,2},\dots,x_{i,m})$ of size $m$ that satisfy the conditions below: - $x_{i,j}$ is an integer in $[1,n]$; - For any two tuples, after removing an element from the same position in both tuples, the resulting tuples (which have size $m-1$) are not equal. In other words, there still exists at least one position at which the remaining elements differ. Formally, you need to satisfy: - $\forall 1\le i\le k,1\le j\le m,x_{i,j}\in [1,n] \cap \mathbb{Z^+}$; - $\forall 1\le i

Input Format

The first line contains three integers $n$, $m$, and $k$.

Output Format

Print $k$ lines. Each line should contain $m$ integers — the $j$-th integer in the $i$-th line represents $x_{i,j}$.

Explanation/Hint

This problem involves a large output size, so I/O optimization is recommended. The problem uses subtask dependencies: failing a prerequisite subtask will result in a score of zero for any subtask. It is guaranteed that for all testcases, $1\le n\le 10^9,2\le m\le 10^5,1\le k \le n^{m-1},k\times m\le 10^6$。 |#|$n$|$m$|$k$|Points|Depends On| |:-------:|:-:|:-:|:-:|:--:|:-:| |$1$|$\le 10^9$|$=2$|$\le n$|$10$|-| |$2$|$\le 10^9$|$\le 10^5$|$\le n$|$5$|$1$| |$3$|$\le 10$|$=3$|-|$20$|-| |$4$|$\le 10$|$\le 10$|$\le 10$|$20$|-| |$5$|$\le 10^4$|$\le 100$|-|$20$|$3,4$| |$6$|$\le 10^9$|$\le 10^5$|-|$25$|$1\sim 5$|