← Back to the problem

Kazakhstan FAIO 2024 · Statement

F. Gravitational Matrix

Formatted by IOAI Training from the original (BeksultanSagyndyk/faio-tasks, licence Apache-2.0). The original is authoritative.

https://contest.yandex.ru/contest/71291/problems/F/

Time limit: 1 second
Memory limit: 64 MB
Input: standard input or input.txt
Output: standard output or output.txt

Arman, the Gravitational Architect, and Roony, the Spatial Stabilization Technician, need to compute the product of two matrices representing gravitational parameters on the FAIO space station.

Given two matrices:

  • The first matrix has size a × b.
  • The second matrix has size b × c.

Compute their product (first multiplied by second) and output the resulting a × c matrix.


Input

  • Three natural numbers a, b, c — the matrix dimensions.
  • Then follow a lines, each containing b real numbers — the first matrix.
  • Then follow b lines, each containing c real numbers — the second matrix.

Constraints

  • (1 \le a, b, c \le 300).
  • Matrix multiplication is valid since the first has b columns and the second has b rows.
  • All matrix entries are real numbers.

Output

Print the product matrix as a lines, each containing c real numbers separated by spaces.