AT_arc226_e.Cellular Messenger

NOI/NOI+/CTSC

通过率:0%

时间限制:2.00s

内存限制:1024MB

AC君温馨提醒

该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Snuke wants to design a cellular automaton that conveys a binary sequence, written into a certain cell over NN turns, to a distant cell.

1. Grid

There is an infinitely large grid. Each cell has a state of 00 or 11.

Let some row of the grid be row 00 and some column be column 00, with row numbers increasing by 11 downward and column numbers increasing by 11 to the right. Let (r,c)(r,c) denote the coordinates of the cell at row rr and column cc. The coordinates of the cells are as shown in the figure below.

The cells adjacent to a given cell refer to the eight cells sharing an edge or a vertex with it.

You may choose a rectangular region satisfying the following conditions, and freely set the initial states of the cells within the region.

  • Both the height HH and the width WW are between 11 and 150150, inclusive.
  • The coordinates of the top-left cell are (0,0)(0,0).

The initial states of all cells outside the region are 00.

2. Update Operation

Decide on a value Fi,jF_{i,j}, either 00 or 11, for each i=0,1i=0,1 and j=0,1,…,8j=0,1,\ldots,8; let these values be the update rule. However, F0,0=0F_{0,0}=0 must hold.

In the update operation, the states of all cells are updated simultaneously. For a given cell, let ii be its state before the update and jj be the sum of the states of the eight adjacent cells; then its state after the update is Fi,jF_{i,j}.

3. Designing the Automaton

You need to decide on and output the following values.

  • The update rule Fi,jF_{i,j} (i=0,1)(i=0,1) (0≤j≤8)(0 \le j \le 8)
    • F0,0=0F_{0,0}=0 must hold.
  • The height HH and width WW of the rectangular region for which the initial state is set
    • Both HH and WW must be between 11 and 150150, inclusive.
  • The initial states Ar,cA_{r,c} (0≤r<H)(0 \le r \lt H) (0≤c<W)(0 \le c \lt W) within the rectangular region
  • The coordinates (Rs,Cs)(R_s,C_s) of the sending cell and (Rt,Ct)(R_t,C_t) of the receiving cell
    • 0≤Rs,Rt<H0 \le R_s,R_t \lt H and 0≤Cs,Ct<W0 \le C_s,C_t \lt W must hold.
    • 50≤∣Cs−Ct∣≤10050 \le |C_s-C_t| \le 100 must hold.
  • The delay DD from sending to receiving
    • It must be possible to read, at the receiving cell on turn k+D−1k+D-1, the value that was written to the sending cell on turn kk.
    • 50≤D≤10050 \le D \le 100 must hold.

4. Judging Method

Judging is performed as follows.

  1. Decide on a positive integer NN and a sequence S=(S1,S2,…,SN)S=(S_1,S_2, \ldots ,S_N) of length NN consisting of 00s and 11s. These are fixed for each test case.

  2. Receive the design of the automaton that you output.

  3. Prepare an empty sequence TT, and simulate N+D−1N+D-1 turns starting from the initial state. Specifically, for each k=1,2,…,N+D−1k=1,2,\ldots,N+D-1, perform the following steps in order on turn kk.

    1. If k≤Nk \le N, change the state of the sending cell (Rs,Cs)(R_s,C_s) to SkS_k.
    2. Perform one update operation on the grid.
    3. If D≤k<D+ND \le k < D+N, append the state of the receiving cell (Rt,Ct)(R_t,C_t) to the end of TT.
  4. After the simulation ends, if S=TS=T, your output is judged correct; otherwise, it is judged incorrect.

It is guaranteed that there exists a design of the automaton that is judged correct regardless of NN and SS, but due to implementation details of the judge for this problem, NN and SS are fixed for each test case file, and only cases with N≤300N \le 300 are used.

すぬけさんは、NN ターンにわたってある特定のセルに書き込まれた 0/1 の列を、遠く離れた別のセルへと伝達するセルオートマトンを設計したいと考えています。

1.グリッド

無限に広いグリッドが存在します。各セルの状態は 00 または 11 のいずれかです。

グリッドの適当な行を「行 00」、適当な列を「列 00」とし、行番号は下方向に 11 ずつ増加し、列番号は右方向に 11 ずつ増加するものとします。(r,c)(r,c) は、行 rr、列 cc にあるセルの座標を表します。セルの座標は以下の図の通りです。

あるセルの「隣接セル」とは、そのセルと辺または頂点を共有する 8 個のセルを指します。

以下の条件を満たす長方形領域を自由に選び、その領域内のセルの初期状態を任意に設定できます。

  • 高さ HH および幅 WW はともに 11 以上 150150 以下(両端含む)である。
  • 左上角のセルの座標は (0,0)(0,0) である。

領域外のすべてのセルの初期状態は 00 です。

2.更新操作

各 i=0,1i=0,1 および j=0,1,…,8j=0,1,\ldots,8 に対して値 Fi,j∈{0,1}F_{i,j} \in \{0,1\} を定め、これを更新規則と呼びます。ただし、F0,0=0F_{0,0}=0 でなければなりません。

更新操作では、すべてのセルの状態が同時に更新されます。あるセルについて、更新前の状態を ii、その 8 個の隣接セルの状態の和を jj とするとき、更新後の状態は Fi,jF_{i,j} となります。

3.オートマトンの設計

以下の値を決定し、出力する必要があります。

  • 更新規則 Fi,jF_{i,j}(i=0,1i=0,1,0≤j≤80 \le j \le 8)
    • F0,0=0F_{0,0}=0 を満たさなければならない。
  • 初期状態を設定する長方形領域の高さ HH および幅 WW
    • HH および WW はともに 11 以上 150150 以下(両端含む)でなければならない。
  • 長方形領域内の初期状態 Ar,cA_{r,c}(0≤r<H0 \le r \lt H,0≤c<W0 \le c \lt W)
  • 送信セルの座標 (Rs,Cs)(R_s,C_s) および 受信セルの座標 (Rt,Ct)(R_t,C_t)
    • 0≤Rs,Rt<H0 \le R_s,R_t \lt H かつ 0≤Cs,Ct<W0 \le C_s,C_t \lt W を満たさなければならない。
    • 50≤∣Cs−Ct∣≤10050 \le |C_s-C_t| \le 100 を満たさなければならない。
  • 送信から受信までの遅延 DD
    • ターン kk に送信セル (Rs,Cs)(R_s,C_s) に書き込まれた値が、ターン k+D−1k+D-1 に受信セル (Rt,Ct)(R_t,C_t) で読み取れることを保証しなければならない。
    • 50≤D≤10050 \le D \le 100 を満たさなければならない。

4.判定方法

判定は以下のように行われます。

  1. 正の整数 NN および長さ NN の 0/1 列 S=(S1,S2,…,SN)S=(S_1,S_2, \ldots ,S_N) を決定します。これらは各テストケースごとに固定されます。

  2. あなたが出力したオートマトンの設計を受け取ります。

  3. 空の列 TT を用意し、初期状態から N+D−1N+D-1 ターンのシミュレーションを行います。具体的には、各 k=1,2,…,N+D−1k=1,2,\ldots,N+D-1 について、ターン kk において以下の手順を順に行います。

    1. k≤Nk \le N ならば、送信セル (Rs,Cs)(R_s,C_s) の状態を SkS_k に変更する。
    2. グリッド全体に対して 1 回の更新操作を行う。
    3. D≤k<D+ND \le k < D+N ならば、受信セル (Rt,Ct)(R_t,C_t) の状態を TT の末尾に追加する。
  4. シミュレーション終了後、S=TS=T が成り立てば正解と判定され、そうでなければ不正解と判定されます。

任意の NN および SS に対しても正解となるようなオートマトンの設計が必ず存在することが保証されていますが、本問題のジャッジ実装の都合上、各テストケースファイルにおいて NN および SS は固定されており、また N≤300N \le 300 のみが使用されます。

输入格式

This problem provides no input.

本题不提供输入。

输出格式

Output in the following format:

F0,0F0,1…F0,8F_{0,0}F_{0,1}\ldots F_{0,8}
F1,0F1,1…F1,8F_{1,0}F_{1,1}\ldots F_{1,8}
HH WW
A0,0A0,1…A0,W−1A_{0,0}A_{0,1}\ldots A_{0,W-1}
A1,0A1,1…A1,W−1A_{1,0}A_{1,1}\ldots A_{1,W-1}
⋮\vdots
AH−1,0AH−1,1…AH−1,W−1A_{H-1,0}A_{H-1,1}\ldots A_{H-1,W-1}
RsR_s CsC_s RtR_t CtC_t DD

Your output must satisfy the following conditions.

  • Fi,j∈0,1F_{i,j} \in {0,1}
  • F0,0=0F_{0,0} = 0
  • 1≤H,W≤1501 \le H,W \le 150
  • Ar,c∈0,1A_{r,c} \in {0,1}
  • 0≤Rs,Rt<H0 \le R_s,R_t \lt H
  • 0≤Cs,Ct<W0 \le C_s,C_t \lt W
  • 50≤∣Cs−Ct∣≤10050 \le |C_s-C_t| \le 100
  • 50≤D≤10050 \le D \le 100

If your output satisfies the above conditions, and is judged correct by the judging method described above for all prepared test cases, this problem is considered solved.

按以下格式输出:

F0,0F0,1…F0,8F_{0,0}F_{0,1}\ldots F_{0,8}
F1,0F1,1…F1,8F_{1,0}F_{1,1}\ldots F_{1,8}
HH WW
A0,0A0,1…A0,W−1A_{0,0}A_{0,1}\ldots A_{0,W-1}
A1,0A1,1…A1,W−1A_{1,0}A_{1,1}\ldots A_{1,W-1}
⋮\vdots
AH−1,0AH−1,1…AH−1,W−1A_{H-1,0}A_{H-1,1}\ldots A_{H-1,W-1}
RsR_s CsC_s RtR_t CtC_t DD

你的输出必须满足以下条件:

  • Fi,j∈{0,1}F_{i,j} \in \{0,1\}
  • F0,0=0F_{0,0} = 0
  • 1≤H,W≤1501 \le H,W \le 150
  • Ar,c∈{0,1}A_{r,c} \in \{0,1\}
  • 0≤Rs,Rt<H0 \le R_s,R_t < H
  • 0≤Cs,Ct<W0 \le C_s,C_t < W
  • 50≤∣Cs−Ct∣≤10050 \le |C_s-C_t| \le 100
  • 50≤D≤10050 \le D \le 100

若你的输出满足上述所有条件,且对所有预设测试用例均能通过前述评测方法判定为正确,则本题视为解答成功。

说明/提示

Visualizer

You can check the behavior of your automaton using the visualizer.

Constraints

  • The NN used by the judge is between 11 and 300300, inclusive.

可视化工具

你可以使用 可视化工具 来检查你的自动机的行为。

限制条件

  • 评测所用的 NN 在 11 到 300300(含)之间。

输入解题思路,AI测评打分。不知道怎么写?

首页