ユニークビジョンプログラミングコンテスト2026 夏(AtCoder Regular Contest 226)
E
蜂窝信使
Cellular Messenger
AtCoder
⌀ 3505
原题
← D→

蜂窝信使AI (CI翻译)

Problem Statement

题目描述

AI (CI翻译)

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

Snuke 想要设计一种元胞自动机,将在 $N$ 个回合中写入某个单元格的二进制序列传递到远处的另一个单元格。

AI (CI翻译)
1. Grid
1. 网格
AI (CI翻译)

There is an infinitely large grid. Each cell has a state of $0$ or $1$.

有一个无限大的网格。每个单元格的状态为 $0$ 或 $1$。AI (CI翻译)

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

令网格中的某一行为第 0 行,某一列为第 0 列,行号向下每次增加 $1$,列号向右每次增加 $1$。行号为 $r$、列号为 $c$ 的单元格坐标记为 $(r,c)$。下图展示了单元格的坐标。AI (CI翻译)

image

imageAI (CI翻译)

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

给定单元格的相邻单元格,是指与其共享边或顶点的八个单元格。AI (CI翻译)

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

你可以选择一个满足以下条件的矩形区域,并自由设置该区域内单元格的初始状态。AI (CI翻译)

  • Both the height $H$ and the width $W$ are between $1$ and $150$, inclusive.
  • The coordinates of the top-left cell are $(0,0)$.
  • 高度 $H$ 和宽度 $W$ 均在 $1$ 到 $150$ 之间(含端点)。
  • 左上角单元格的坐标为 $(0,0)$。
AI (CI翻译)

The initial states of all cells outside the region are $0$.

区域外所有单元格的初始状态均为 $0$。AI (CI翻译)

2. Update Operation
2. 更新操作
AI (CI翻译)

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

对于每个 $i=0,1$ 和 $j=0,1,\ldots,8$,决定一个值 $F_{i,j}$,其值为 $0$ 或 $1$;这些值构成更新规则。但是,必须满足 $F_{0,0}=0$。AI (CI翻译)

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

在更新操作中,所有单元格的状态会同时更新。对于给定的单元格,令 $i$ 表示更新前该单元格的状态,令 $j$ 表示八个相邻单元格的状态之和,则更新后该单元格的状态为 $F_{i,j}$。AI (CI翻译)

3. Designing the Automaton
3. 设计元胞自动机
AI (CI翻译)

You need to decide on and output the following values.

你需要决定并输出以下数值。AI (CI翻译)

  • The update rule $F_{i,j}$ $(i=0,1)$ $(0 \le j \le 8)$
  • $F_{0,0}=0$ must hold.
  • The height $H$ and width $W$ of the rectangular region for which the initial state is set
  • Both $H$ and $W$ must be between $1$ and $150$, inclusive.
  • The initial states $A_{r,c}$ $(0 \le r \lt H)$ $(0 \le c \lt W)$ within the rectangular region
  • The coordinates $(R_s,C_s)$ of the sending cell and $(R_t,C_t)$ of the receiving cell
  • $0 \le R_s,R_t \lt H$ and $0 \le C_s,C_t \lt W$ must hold.
    • $50 \le |C_s-C_t| \le 100$ must hold.
  • The delay $D$ from sending to receiving
  • It must be possible to read, at the receiving cell on turn $k+D-1$, the value that was written to the sending cell on turn $k$.
    • $50 \le D \le 100$ must hold.
  • 更新规则 $F_{i,j}$ $(i=0,1)$ $(0 \le j \le 8)$
  • 必须满足 $F_{0,0}=0$。
  • 设置初始状态的矩形区域的高度 $H$ 和宽度 $W$
  • $H$ 和 $W$ 均必须在 $1$ 到 $150$ 之间(含端点)。
  • 矩形区域内的初始状态 $A_{r,c}$ $(0 \le r \lt H)$ $(0 \le c \lt W)$
  • 发送单元格的坐标 $(R_s,C_s)$ 和接收单元格的坐标 $(R_t,C_t)$
  • 必须满足 $0 \le R_s,R_t \lt H$ 且 $0 \le C_s,C_t \lt W$。
    • 必须满足 $50 \le |C_s-C_t| \le 100$。
  • 从发送到接收的延迟 $D$
  • 必须能够在第 $k+D-1$ 个回合的接收单元格中,读出第 $k$ 个回合写入发送单元格的值。
    • 必须满足 $50 \le D \le 100$。
AI (CI翻译)
4. Judging Method
4. 评测方法
AI (CI翻译)

Judging is performed as follows.

评测过程如下。AI (CI翻译)

  1. Decide on a positive integer $N$ and a sequence $S=(S_1,S_2, \ldots ,S_N)$ of length $N$ consisting of $0$s and $1$s. These are fixed for each test case.
  2. Receive the design of the automaton that you output.
  3. Prepare an empty sequence $T$, and simulate $N+D-1$ turns starting from the initial state. Specifically, for each $k=1,2,\ldots,N+D-1$, perform the following steps in order on turn $k$.
  • If $k \le N$, change the state of the sending cell $(R_s,C_s)$ to $S_k$.
    • Perform one update operation on the grid.
    • If $D \le k < D+N$, append the state of the receiving cell $(R_t,C_t)$ to the end of $T$.
  1. After the simulation ends, if $S=T$, your output is judged correct; otherwise, it is judged incorrect.
  1. 决定一个正整数 $N$ 和一个长度为 $N$、由 $0$ 和 $1$ 组成的序列 $S=(S_1,S_2, \ldots ,S_N)$。这些内容对每个测试用例都是固定的。
  2. 接收你输出的元胞自动机设计方案。
  3. 准备一个空序列 $T$,从初始状态开始模拟 $N+D-1$ 个回合。具体来说,对于每个 $k=1,2,\ldots,N+D-1$,按顺序执行第 $k$ 个回合中的以下步骤。
  • 如果 $k \le N$,将发送单元格 $(R_s,C_s)$ 的状态改为 $S_k$。
    • 在网格上执行一次更新操作。
    • 如果 $D \le k < D+N$,将接收单元格 $(R_t,C_t)$ 的状态追加到 $T$ 的末尾。
  1. 模拟结束后,如果 $S=T$,则判定输出正确;否则判定输出错误。
AI (CI翻译)

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

保证存在一种无论 $N$ 和 $S$ 如何取值都能被判定为正确的元胞自动机设计方案。但是,由于本题评测器的实现细节,$N$ 和 $S$ 对每个测试用例文件都是固定的,并且只使用满足 $N \le 300$ 的测试用例。AI (CI翻译)

Constraints

约束条件

AI (CI翻译)
  • The $N$ used by the judge is between $1$ and $300$, inclusive.
  • 评测器使用的 $N$ 在 $1$ 到 $300$ 之间(含端点)。
AI (CI翻译)

Input

输入格式

AI (CI翻译)

This problem provides no input.

本题没有输入。AI (CI翻译)

Output

输出格式

AI (CI翻译)

Output in the following format:

请按照以下格式输出:AI (CI翻译)

F_{0,0}F_{0,1}\ldots F_{0,8}
F_{1,0}F_{1,1}\ldots F_{1,8}
H W
A_{0,0}A_{0,1}\ldots A_{0,W-1}
A_{1,0}A_{1,1}\ldots A_{1,W-1}
\vdots
A_{H-1,0}A_{H-1,1}\ldots A_{H-1,W-1}
R_s C_s R_t C_t D

F_{0,0}F_{0,1}\ldots F_{0,8}
F_{1,0}F_{1,1}\ldots F_{1,8}
H W
A_{0,0}A_{0,1}\ldots A_{0,W-1}
A_{1,0}A_{1,1}\ldots A_{1,W-1}
\vdots
A_{H-1,0}A_{H-1,1}\ldots A_{H-1,W-1}
R_s C_s R_t C_t D
AI (CI翻译)

Your output must satisfy the following conditions.

你的输出必须满足以下条件。AI (CI翻译)

  • $F_{i,j} \in \{0,1\}$
  • $F_{0,0} = 0$
  • $1 \le H,W \le 150$
  • $A_{r,c} \in \{0,1\}$
  • $0 \le R_s,R_t \lt H$
  • $0 \le C_s,C_t \lt W$
  • $50 \le |C_s-C_t| \le 100$
  • $50 \le D \le 100$
  • $F_{i,j} \in \{0,1\}$
  • $F_{0,0} = 0$
  • $1 \le H,W \le 150$
  • $A_{r,c} \in \{0,1\}$
  • $0 \le R_s,R_t \lt H$
  • $0 \le C_s,C_t \lt W$
  • $50 \le |C_s-C_t| \le 100$
  • $50 \le D \le 100$
AI (CI翻译)

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.

如果你的输出满足上述条件,并且对于所有准备好的测试用例都通过上述评测方法的判定,则认为本题已解决。AI (CI翻译)

Sample Output

样例输出

AI (CI翻译)

000100000
001100000
4 54
100000000000000000000000000000000000000000000000000000
000010000000000000000000000000000000000000000000000000
100010000000000000000000000000000000000000000000000000
011110000000000000000000000000000000000000000000000000
0 3 0 53 100

000100000
001100000
4 54
100000000000000000000000000000000000000000000000000000
000010000000000000000000000000000000000000000000000000
100010000000000000000000000000000000000000000000000000
011110000000000000000000000000000000000000000000000000
0 3 0 53 100
AI (CI翻译)

This sample output is provided to illustrate the output format. For $N=1$, it is correct for all $S$, but for $2 \le N$, there exist some $S$ for which it is incorrect.

该样例输出用于说明输出格式。对于 $N=1$,它对所有 $S$ 都是正确的;但对于 $2 \le N$,存在一些 $S$ 使其不正确。AI (CI翻译)

Visualizer

可视化工具

AI (CI翻译)

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

你可以使用可视化工具查看你的元胞自动机的运行情况。AI (CI翻译)

题目信息

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