QOJ.ac

QOJ

Limite de temps : 1.0 s Limite de mémoire : 512 MB Points totaux : 100

#12942. 彩虹赞博尼

Statistiques

Pacman 正在清理他的溜冰场!这个溜冰场和 PacMan 宇宙中的一切一样,是循环的!换句话说,如果你从矩形溜冰场的右边缘走出去,你会出现在同一行的左侧。从左侧走出去,你会出现在右侧。从顶部走出去,你会出现在同一列的底部。从底部走出去,你会出现在顶部。

这台赞博尼(zamboni)除冰车的特别之处在于,当它清理冰面时,会在冰面上留下颜色!起初,冰面是无色的(白色)。每当赞博尼位于某个冰格上时,它就会覆盖该格上的颜色。每种颜色由一个大写字母表示。颜色按字母顺序排列。赞博尼在每一步都会切换到字母表中的下一个字母,并在字母表末尾循环。如果当前颜色是 P,则下一种颜色是 Q。如果当前颜色是 Z,则下一种颜色是 A。

PacMan 使用一种非常特定的算法来清理冰面:

stepSize ← 1
loop numSteps times
    Move stepSize steps in the current direction
    Rotate the direction of the zamboni 90 degrees clockwise
    Switch to the next color
    stepSize ← stepSize + 1
end loop

赞博尼最初面朝上方。在已知赞博尼起始位置、溜冰场大小以及所走步数的情况下,确定赞博尼完成运行后冰面的样子。

输入格式

每个输入包含一个测试用例。请注意,你的程序可能会在不同的输入上多次运行。每个输入由一行包含 5 个空格分隔的整数 $r, c, i, j, n$ 组成,其中:

  • $r$ ($1 \le r \le 2000$) 是溜冰场的行数
  • $c$ ($1 \le c \le 2000$) 是溜冰场的列数
  • $i$ ($1 \le i \le r$) 是赞博尼的起始行
  • $j$ ($1 \le j \le c$) 是赞博尼的起始列
  • $n$ ($1 \le n \le 10^{18}$) 是步数(PacMan 算法中的 numSteps)

注意,第 1 行是顶行,第 1 列是左列。

输出格式

输出赞博尼完成运行后溜冰场的状态,为一个 $r \times c$ 的字符网格。每个字符应为一个代表冰面颜色的大写字母(A-Z),或者用点(.)表示冰面为白色,或者用“at”符号(@)表示该单元格是赞博尼的最终位置。

样例

样例输入 1

5 5 3 3 4

样例输出 1

.....
..BBC
..A.C
....C
@DDDD

样例输入 2

5 5 3 3 7

样例输出 2

EG...
E@BBC
EGA.C
EG..C
FGFFF

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.