#P7218. [JOISC 2020] 伝説の団子職人

    ID: 7598 远端评测题 1000ms 128MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>2020提交答案Special Judge模拟退火随机化JOI(日本)

[JOISC 2020] 伝説の団子職人

Background

You are a dango skewer master, and you are very strong.

Problem Description

In front of you is an R×CR \times C grid. Each cell contains one dango. You may skewer three consecutive dango in order in a horizontal, vertical, or diagonal direction. “In order” means you may skewer them as top-middle-bottom, bottom-middle-top, etc., but you may not skewer them as middle-bottom-top, top-bottom-middle, etc.

If the colors of a skewered triple are green, white, pink or pink, white, green, then this triple is called an AK IOI skewer.

Find a way to skewer as many AK IOI skewers as possible (I firmly believe that making several AK IOI skewers will let you AK IOI several times).

Input Format

The first line contains two integers R,CR, C representing the grid size.
Then follow RR lines, each containing CC characters representing the grid:

  • P represents a pink dango.
  • W represents a white dango.
  • G represents a green dango.

Output Format

Output RR lines, each containing CC characters representing the skewered grid:

  • It may be -, |, /, \, representing a skewer passing through a dango.
  • If it is not one of the above four symbols, output it as-is.

The output files should be 01.ans ~ 06.ans.

3 4
PWGP
WGPW
GWPG
P-GP
WGP|
G-PG
3 4
PWWP
WWWW
PGGP
PWWP
W\/W
PGGP

Hint

Sample 1 Explanation

You made 33 AK IOI skewers.

Sample 2 Explanation

You made 22 AK IOI skewers.

Constraints

This is an output-only problem.

This problem uses Special Judge.

There are 66 testdata. It is guaranteed that 3R,C5003 \le R, C \le 500. The input files can be obtained from the attachment. The detailed table is as follows:

Test case Score SS Pass line XX Good line YY Excellent line ZZ
11 1515 4400044000 4700047000 4722047220
22 3900039000 4170041700 4198041980
33 4500045000 5100051000 5139051390
44 1800018000 1900019000 1912019120
55 2020 4300043000 4820048200 4862048620
66 4400044000 4600046000 4650046500

Suppose NN is the number of AK IOI skewers you obtain. Then the scoring rule is (rounded to the nearest integer):

  • If N<XN < X, then 00 points.
  • If XN<YX \le N < Y, then NX2(YX)×S\dfrac{N-X}{2(Y-X)} \times S points.
  • If YN<ZY \le N < Z, then $\left(\dfrac{1}{2}+\dfrac{N-Y}{2(Z-Y)}\right) \times S$ points.
  • If ZNZ \le N, then SS points.

If the output format is incorrect or the output is invalid, you will receive 00 points.

Notes

Translated from The 19th Japanese Olympiad in Informatics Spring Training Camp Day 4 B The Legendary Dango Skewer Master.

Translated by ChatGPT 5