Problem list
Log in
#r03087 · Online Judge > GoldOJ

Fill a 2D List

Bronze III 2.0 s 1024 MB

Build an $n \times m$ grid of zeros. Then apply $Q$ updates, each r c x setting the cell at row $r$, column $c$ (0-based) to $x$. Print the final grid, rows on separate lines, values space-separated.

Input

Line 1: $n$ $m$. Line 2: $Q$. Next $Q$ lines: r c x.

Output

Print the final $n \times m$ grid.

Example 1

Input
3 4
5
0 0 7
1 2 5
2 3 9
1 2 8
0 3 4
Output
7 0 0 4
0 0 8 0
0 0 0 9
Source
Online Judge > GoldOJ
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code