当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3423:Automaton optimization

题目描述

Linear cellular automaton is an infinite sequence of cells, each holding either 0 or 1. Cells are indexed with integers, extending from some chosen "zero" cell in both positive and negative directions.

In the initial (first) state all except the finite number of cells contain 0. Next state is computed from previous one by a simple rule: new cell value is 1 if the cell had exactly one neighbour with value 1, otherwise 0.

Although computing states is easy and fast, researchers are often interested in states after very many steps. Because these states may occupy large amount of memory, only parts of them are usually printed.

Your program must, given the initial state, quickly find values for S-th state for cells with indexes F, F + 1, …, F + L − 1.

输入解释

Input file contains number of non-zero cells in the initial state N, followed by their indexes i1 i2 ... iN, and then integers S F L. All indexes are different.

Constraints

1 ≤ S ≤ 109, −109F ≤ 109, 1 ≤ L, N ≤ 2000, −1000 ≤ ik ≤ 1000

输出解释

Output file must contain L values, each of them either 0 or 1.

输入样例
Sample Input 1
2
1 2
7 -5 5
Sample Input 2
1
0
1 -4 8
输出样例
Sample Output 1
1 1 0 0 1
Sample Output 2
0 0 0 0 1 0 0 0
提示
Bold texts appearing in the sample sections are informative and do not form part of the actual data.

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-3423

最后修改于 2020-10-29T07:01:17+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000 65536