User's AC Ratio

100.0% (46/46)

Submission's AC Ratio

54.2% (52/96)

Description

Given two matrices $A$, $B$ with size $n \times m$ and $m \times p$ respectively, where

$
A_{n\times m} = \begin{bmatrix}
a_{11} & a_{12} & \dots & a_{1m} \\
a_{21} & a_{22} & \dots & a_{2m} \\
\vdots & \vdots & \ddots & \vdots \\
a_{n1} & a_{n2} & \dots & a_{nm}
\end{bmatrix}
,\ B_{m\times p} = \begin{bmatrix}
b_{11} & b_{12} & \dots & b_{1p} \\
b_{21} & b_{22} & \dots & b_{2p} \\
\vdots & \vdots & \ddots & \vdots \\
b_{m1} & b_{m2} & \dots & b_{mp}
\end{bmatrix}
$

The result of multiplication of $A$ and $B$ is a matrix with size $n \times p$, where each element

$
ab_{ij} = \displaystyle \sum_{k=1} ^ {m} a_{ik} b_{kj}
,$ for $1 \leq i \leq n$ and $1 \leq j \leq p$

Input Format

The first line contains three integers representing $n $, $m$ and $p$ $(1 \leq n, m, p \leq 100)$,
and is followed by $n + m$ lines: the first $n$ lines represent matrix $A$, and the other $m$ lines are for matrix $B$. $(0 \leq a_{ij}, b_{ij} \leq 1000)$

Output Format

$n$ lines with $p$ elements in each line, representing the result of multiplication of $A$ and $B$.

Sample Input 1

2 3 2
1 2 3
2 4 5
1 3
2 4
4 2

Sample Output 1

17 17
30 32

Hints

In the sample,
$
A = \begin{bmatrix}
1 & 2 & 3 \\
2 & 4 & 5 \\
\end{bmatrix}
,\ B = \begin{bmatrix}
1 & 3 \\
2 & 4 \\
4 & 2 \\
\end{bmatrix}
$

Problem Source

Subtasks

No. Testdata Range Score
1 0~5 10

Testdata and Limits

No. Time Limit (ms) Memory Limit (KiB) Output Limit (KiB) Subtasks
0 1000 65536 65536 1
1 1000 65536 65536 1
2 1000 65536 65536 1
3 1000 65536 65536 1
4 1000 65536 65536 1
5 1000 65536 65536 1