QOJ.ac

QOJ

Límite de tiempo: 4.0 s Límite de memoria: 64 MB Puntuación total: 100

#18080. 不连续序列

Estadísticas

设 $X$ 为一个序列 $(x_1, x_2, \dots, x_n)$。则其非周期自相关函数 $N_X(s)$ 定义为:

$$N_X(s) = \sum_{i=-\infty}^{\infty} x_i x_{i+s}$$

其中 $s$ 为整数。在此我们假设对于 $i < 1$ 和 $i > n$ 的情况,有 $x_i = 0$。

考虑四个长度分别为 $n, n, n$ 和 $n-1$ 的序列 $(A, B, C, D)$,其所有元素均来自集合 $\{-1, +1\}$。这四个序列构成一个 $TT$-序列(Turyn-Type sequence)当且仅当对于所有整数 $s > 0$ 满足:

$$N_A(s) + N_B(s) + 2N_C(s) + 2N_D(s) = 0$$

$TT$-序列非常有趣,因为它们可以用于构建哈达玛矩阵(Hadamard matrices),这些矩阵在信号处理和编码理论等领域有广泛应用。例如,2005 年发现的一个 $n=36$ 的 $TT$-序列首次实现了 428 阶哈达玛矩阵的构造。

给定一个缺失了若干元素的 $TT$-序列,请还原出初始的 $TT$-序列。

输入格式

输入包含四行,分别为长度为 $n, n, n$ 和 $n-1$ 的字符串($2 \le n \le 36$,$n$ 为偶数),它们分别编码了序列 $A, B, C$ 和 $D$。第 $i$ 个字符编码了对应序列的第 $i$ 个元素。“-” 表示 $-1$,“+” 表示 $+1$,“?” 表示缺失的元素。缺失元素的总数不超过 30 个。

保证对于给定的数据,存在唯一的解。

输出格式

输出四行,分别为长度为 $n, n, n$ 和 $n-1$ 的字符串,表示还原后的 $TT$-序列。请参考样例以更好地理解输出格式。

样例

样例输入 1

++-+-?-+
+----?-+
+--++?+-
+++-+?-

样例输出 1

++-+-+-+
+------+
+--++++-
+++-++-

样例输入 2

+++----++-+-+?-?--++++-++-++++----+-
+-+++++?-+-+--+--++--?+++-++++---++-
+-+++++-+--?+++-+?+-++--+++-+--+-?-+
+++-+?----++--+-+++?-+-+-+++-+?++-+

样例输出 2

+++----++-+-+-----++++-++-++++----+-
+-+++++--+-+--+--++--++++-++++---++-
+-+++++-+--++++-+++-++--+++-+--+---+
+++-+-----++--+-+++--+-+-+++-++++-+

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.