3077 - I2P(I)2024_Hu_Lab4 Scoreboard

Time

2024/09/30 18:30:00 2024/09/30 20:30:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
14418 Conway's Game Of Love
14419 Kaela's New Sword

14418 - Conway's Game Of Love   

Description

The night breeze is cold; the past feels like a dream.
My heart is frozen; how can anyone bear knowing but not meeting?
It's hard to let go of the pain and the wind-like love.
Hard to forget you who roam yet in my heart.

 

I planted H x W roses for you in a gridded flower bed. Since the day we parted, the grid changed according to certain rules:

1. The blooming flower in a cell with 0 or 1 blooming neighbor withers due to loneliness.
2. The flower in a cell with 2 blooming neighbors stays the same, withered or blooming.
3. The withered flower in a cell with 3 blooming neighbors blooms due to the power of love.
4. The blooming flower in a cell with at least 4 blooming neighbors withers due to the competition.

Here, "neighbors of a cell"  refers to the flowers in all cells around that certain cell, including diagonally connected ones. The cells at the corners and the edges have 3 and 5 neighbors respectively.

For example, suppose this was the bed before the breakup,

If we count the number of neighbors in each cell, we get:

Therefore, applying the rules to each cell, the new withered cells (dark green) and the new blooming cells (blue) are:

And the flower bed after the breakup is:

 

Given the initial flower configurations, output the flower bed after the breakup.

Input

The first line contains two numbers, H and W (1 <= H, W <= 256), representing the size of the flower bed.

The next H lines contain W numbers, 0 for the withered flowers and 1 for the blooming flower before the breakup.

Output

The flower bed after the breakup with a space after the numbers, including the last ones in each line.

Sample Input  Download

Sample Output  Download

Tags




Discuss




14419 - Kaela's New Sword   

Description

Image Credit: @ZetsuenTai_8488 on X, Formerly Twitter (https://x.com/ZetsuenTai_8488/status/1684085953856671746)

 

Kaela the blacksmith was exploring an ancient cave to gather some materials to craft an ultimate sword when she came across a beautiful crystal of a rare mineral called Bijouite, also known as the jewel of emotions. This crystal has a clear octahedral shape with concentric layers. To craft an ultimate sword, Kaela needs a thin slice of this crystal, but directly slicing such a rare gem is a tough task as jewels of emotions are known to be extremely fragile. To avoid damaging the crystal, Kaela asked you to write a program to visualize the cross-section of the crystal at any given depth.

The crystal’s cross-section at any depth forms a diamond-shaped pattern. The outermost layer of the diamond is labeled with the letter 'A'. The subsequent inner layers are labeled 'B', 'C', and so forth. After 'Z', the labeling wraps around to 'A' again and continues.

Here is an animation showing the cross-section of the crystal with 5 layers, varying D.

Note that there are spaces before and after the characters. You have to print them out too. For example, for L = 5 and D = 6, you must print:

·········
·········
····A····
···ABA···
··ABCBA··
···ABA···
····A····
·········
·········

 

Input

The input consists of 2 integers, L and D.
L (1 ≤ L ≤ 1000): The total number of layers in the crystal.
D (0 ≤ D < 2 * L - 1): The depth of the cross-section

Output

The cross-section of the crystal at depth D. The cross-section should consist of 2L-1 lines with 2L-1 characters on each line, including spaces. The center of the cross-section should be located at the exact middle point of the Lth line. Also, all line has a newline character ('\n') at the end.

Sample Input  Download

Sample Output  Download

Tags




Discuss