QOJ.ac

QOJ

Limite de temps : 0.5 s Limite de mémoire : 1024 MB Points totaux : 100

#11643. LED 计数器

Statistiques

LED 计数器是一种单行排列有 $N$ 个位置的设备。每个位置都能显示 0 到 9 之间的数字,并由七个 LED 灯组成,如下图所示。

要显示特定的数字,只需点亮相应的 LED 灯即可。下图展示了每个数字对应的 LED 点亮情况。

正如你所见,显示数字 0 时,除中间的 LED 外其余全部点亮;显示数字 1 时,右上和右下 LED 点亮,以此类推。

通过点亮计数器 $N$ 个位置中各自对应的 LED,该设备能够显示 $10^N$ 个不同的数值,从 $00\dots0$($N$ 个零)到 $99\dots9$($N$ 个九)。注意,前导零也会被显示。

Astro Void 使用这款 LED 计数器已经有一段时间了,因此设备可能存在一些故障的 LED。正常的 LED 会根据需要点亮或熄灭,而故障的 LED 则始终处于点亮状态或始终处于熄灭状态,与其计数器预期的显示值无关。

给定 Astro Void 的 LED 计数器中每个 LED 的状态描述(正常且点亮、正常且熄灭、始终点亮或始终熄灭),你必须推断出计数器的预期数值,并指出哪些位置无法明确确定。

以一个 $N=3$ 位的 LED 计数器为例,考虑下图。如果所有 LED 都正常,那么计数器的预期数值显然是 056。如果第一个位置的底部 LED 是“始终点亮”的故障 LED,那么计数器的预期数值仍然是 056,因为如图所示,没有其他数值会显示出这种状态。然而,如果第二个位置的左下 LED 是“始终熄灭”的故障 LED,那么计数器的第二个位置就无法明确确定,因为 056 和 066 都会显示出如图所示的状态。

输入格式

第一行包含一个整数 $N$ ($1 \le N \le 10^5$),表示 LED 计数器的位数。

接下来的 $N$ 行,第 $i$ 行包含一个长度为 7 的字符串 $S_i$,描述了计数器第 $i$ 个位置的七个 LED 的状态。$S_i$ 中的每个字符描述了一个特定的 LED,顺序从左到右、从上到下依次为:左上、左下、上、中、下、右上、右下。字符可以是大写字母 “G”(正常且点亮)、小写字母 “g”(正常且熄灭)、加号 “+”(始终点亮)或连字符 “-”(始终熄灭)。保证 $S_i$ 描述了计数器第 $i$ 位 LED 的合法状态。例如,$S_i$ 不会是 “ggggggg”,因为当所有 LED 都正常时,全灭状态无法表示任何数字。

输出格式

输出一行,包含一个长度为 $N$ 的字符串,表示计数器的预期数值。如果计数器的某一位无法明确确定,则在该位置输出字符 “*”(星号)。

样例

样例输入 1

10
GGGgGGG
gggggGG
gGGGGGg
ggGGGGG
GggGgGG
GgGGGgG
GGGGGgG
ggGggGG
GGGGGGG
GgGGGGG

样例输出 1

0123456789

样例输入 2

3
GGGg+GG
GgGGGgG
GGGGGgG

样例输出 2

056

样例输入 3

3
GGGg+GG
G-GGGgG
GGGGGgG

样例输出 3

0*6

样例输入 4

2
+++gG--
---gG++

样例输出 4

00

样例输入 5

1
-+-+-+-

样例输出 5

*

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.