#C5356. Random Warehouse Pallet Placement
Random Warehouse Pallet Placement
Random Warehouse Pallet Placement
You are given a warehouse with N rows and K columns (i.e. each row has a capacity of K cells). You also have M pallets, each with a unique identifier from 1 to M. Your task is to randomly place these M pallets into the warehouse in a row‐wise fashion. If there are more cells than pallets (i.e. if N \times K > M), the remaining cells should be left empty.
In this problem, the randomness is made deterministic by using the fixed seed 42
for the pseudo‐random number generator. In other words, every submission will generate the same warehouse layout for the same input.
Note on Output Format: Each row of the warehouse is printed on a separate line, where the cells are separated by a single space. Trailing whitespace on each line should be removed. Empty cells are printed as an empty string.
The underlying idea is to shuffle the pallet IDs and then fill the warehouse cells row by row. For example, if the input is 2 3 6 and the shuffled order of pallet IDs (using seed 42) is [1, 6, 3, 5, 4, 2], then the warehouse will be:
[ \begin{array}{ccc} 1 & 6 & 3 \ 5 & 4 & 2 \end{array} ]
inputFormat
The input is given from standard input and consists of three space-separated integers:
- N — the number of rows in the warehouse.
- K — the number of columns (capacity per row).
- M — the number of pallets to place (with IDs from 1 to M).
outputFormat
Output the final warehouse layout to standard output. The output consists of N lines, each representing a row of the warehouse. The cells in a row are separated by a single space, and trailing spaces at the end of a line should be removed. If a cell is empty, output an empty string for that cell.
## sample2 3 6
1 6 3
5 4 2
</p>