Preparing NOJ
Joon-Pyo decorated a flowerbed in front of his home. The flowerbed is in the shape of an $$$n \times m$$$ grid, and one flower is planted in each cell. There are 26 colors, one corresponding to each uppercase letter from A to Z. Suddenly, he wanted to redecorate the flowerbed.
Note that the equipment will never go out of the flowerbed, as $$$x$$$, $$$y$$$, and $$$d$$$ are carefully determined before construction begins.
He cannot start construction without knowing the outcome. Write a program that outputs the result.
On the first line, five integers $$$n$$$, $$$m$$$, $$$y$$$, $$$x$$$, and $$$d$$$ are given. ($$$1 \leq n \times m \leq 10^6 $$$, $$$ 1 \leq y \leq n$$$, $$$ 1 \leq x \leq m $$$, $$$ 1 \leq d \leq \min(n, m)$$$, $$$\boldsymbol{n \equiv d \pmod y}$$$, $$$\boldsymbol{m \equiv d \pmod x}$$$).
Each of the next $$$n$$$ lines contains exactly $$$m$$$ uppercase letters, the current flowerbed.
Output $$$n$$$ lines, each containing $$$m$$$ uppercase letters, the flowerbed after the planned construction.
4 4 1 1 2 AAAA BBBB AAAA BBBB
BAAA ABBB BAAA BBBA
6 5 1 2 3 RBRCY YBPBR PBRCY CYPBR PBRCY CYPBR
PYRBR CRCBB PPBPY CRCYB YRBCY PYRBR
Info
Provider CodeForces Gym
Origin XXII Open Cup. Grand Prix of Korea
Code GYM103371D
Tags
Submitted 0
Passed 0
AC Rate 0%
Date 10/31/2021 14:45:05
Related