第七回日本最強プログラマー学生選手権~Advance~ -予選- (AtCoder Beginner Contest 464)
E
填充矩形查询
Fill-Rect Query
AtCoder
⌀ 1075
原题
←F →

填充矩形查询AI (CI翻译)

Problem Statement

题目描述

AI (CI翻译)

There is an $H \times W$ grid. Initially, every cell has A written on it. The cell at the $i$-th row from the top and $j$-th column from the left is denoted by $(i, j)$.

有一个 $H \times W$ 的网格。初始时,每个格子中都写有 A。从上往下数第 $i$ 行、从左往右数第 $j$ 列的格子记为 $(i, j)$。AI (CI翻译)

We will perform $Q$ operations in order. In the $i$-th operation, overwrite all cells in the rectangle with upper-left cell $(1, 1)$ and lower-right cell $(R_i, C_i)$ with the uppercase English letter $X_i$.

我们将按顺序进行 $Q$ 次操作。 在第 $i$ 次操作中,将左上角为 $(1, 1)$、右下角为 $(R_i, C_i)$ 的矩形内的所有格子覆盖为大写英文字母 $X_i$。AI (CI翻译)

Output the grid after all operations have been performed.

输出所有操作执行完毕后的网格。AI (CI翻译)

Constraints

约束条件

AI (CI翻译)
  • $1 \le H, W$
  • $H \times W \le 10^6$
  • $1 \le Q \le 2 \times 10^5$
  • $1 \le R_i \le H$
  • $1 \le C_i \le W$
  • $X_i$ is an uppercase English letter.
  • All input numbers are integers.
  • $1 \le H, W$
  • $H \times W \le 10^6$
  • $1 \le Q \le 2 \times 10^5$
  • $1 \le R_i \le H$
  • $1 \le C_i \le W$
  • $X_i$ 是大写英文字母。
  • 所有输入的数值均为整数。
AI (CI翻译)

Input

输入格式

AI (CI翻译)

The input is given from Standard Input in the following format:

输入从标准输入按以下格式给出:AI (CI翻译)

H W Q
R_1 C_1 X_1
R_2 C_2 X_2
\vdots
R_Q C_Q X_Q

H W Q
R_1 C_1 X_1
R_2 C_2 X_2
\vdots
R_Q C_Q X_Q
AI (CI翻译)

Output

输出格式

AI (CI翻译)

Print $H$ lines. The $i$-th line should contain a string of length $W$, whose $j$-th character is the uppercase English letter written on $(i, j)$ in the grid after the operations.

输出 $H$ 行。第 $i$ 行应包含一个长度为 $W$ 的字符串,其中第 $j$ 个字符是在所有操作执行完毕后写在网格中 $(i, j)$ 位置的大写英文字母。AI (CI翻译)

样例

Input #1
2 3 3
2 2 B
1 3 C
2 1 D
Output #1
DCC
DBA
The operations proceed as shown in the figure. ![image](https://img.atcoder.jp/abc464/4691e1b9f6070a3150b57d5fac58aee4.png)
Input #2
1 7 7
1 7 E
1 6 C
1 5 N
1 4 A
1 3 V
1 2 D
1 1 A
Output #2
ADVANCE
Input #3
10 10 15
8 9 B
6 7 C
5 8 D
10 6 E
8 5 F
3 10 G
7 3 H
4 6 I
3 1 J
10 2 K
3 6 L
3 3 M
2 5 N
9 1 O
1 4 P
Output #3
PPPPNLGGGG
ONNNNLGGGG
OMMLLLGGGG
OKIIIIDDBA
OKHFFEDDBA
OKHFFECBBA
OKHFFEBBBA
OKFFFEBBBA
OKEEEEAAAA
KKEEEEAAAA

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。