QOJ.ac

QOJ

حد الوقت: 4.0 s حد الذاكرة: 64 MB مجموع النقاط: 100

#18080. 壊れた数列

الإحصائيات

$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$ である4つの数列 $(A, B, C, D)$ を考える。これらの要素はすべて集合 $\{-1, +1\}$ に属する。これら4つの数列が $TT$-sequence (Turyn-Type sequence) を形成するのは、すべての整数 $s > 0$ に対して以下の条件が成り立つとき、かつそのときに限る。

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

$TT$-sequence は、信号処理や符号理論などの分野で応用されるアダマール行列を構築できるため、非常に興味深いものである。例えば、$n = 36$ の $TT$-sequence(2005年に発見された)により、初めて次数 428 のアダマール行列を構築することが可能となった。

いくつかの要素が欠落している $TT$-sequence が与えられるので、元の $TT$-sequence を復元せよ。

入力

4行にわたり、長さがそれぞれ $n, n, n, n-1$ ($2 \le n \le 36$, $n$ は偶数) である4つの文字列が与えられる。これらは数列 $A, B, C, D$ を符号化したものである。$i$ 番目の文字は対応する数列の $i$ 番目の要素を表す。「-」は $-1$ を、「+」は $+1$ を、「?」は欠落した要素を表す。欠落した要素の合計数は 30 を超えない。

与えられたデータに対して、解が一意に存在することが保証されている。

出力

復元された $TT$-sequence である、長さ $n, n, n, n-1$ の4つの文字列を出力せよ。出力形式については入出力例を参照のこと。

入出力例

入出力例 1

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

入出力例 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.