시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB151211100.000%

문제

You are a professional making delicious rice dumplings, called dangos. Now you are skewering dangos with sticks.

Dangos are located in a rectangular grid of cells with R rows and C columns. Each cell contains one dango. The color of a dango is pink (P), white (W), or green (G). You will choose three consecutive dangos in the vertical direction (from top to bottom), the horizontal direction (from left to right), or the oblique direction (from left-top to right-bottom, or from right-top to left-bottom). Then you will take three dangos from these cells from end to end, and skewer them to a stick in order, to get a stick of dangos. For example, if you choose three consecutive dangos in the vertical direction, you can take dangos from top-middle-bottom or bottom-middle-top cells, in this order, and skewer them to a stick. You cannot take dangos from middle-bottom-top or bottom-top-middle cells. Moreover, you cannot skewer a dango to more than one stick.

A stick of dangos is beautiful if the colors of the dangos in the stick are pink-white-green or green-whitepink, in this order. You want to make as many beautiful sticks of dangos as possible.

How many beautiful sticks of dangos can you make?

입력

For this task, there is one input data.

The input is given in the following format.

R C
D1
.
.
.
DR

Here Di (1 ≤ i ≤ R) is a string of length C consisting of P, W, and G. The j-th character (1 ≤ j ≤ C) of Di is the color of the dango in the cell located in the i-th row from the top and the j-th column from the left.

출력

The format of the output data is as follows.

S1
.
.
.
SR

Here Si (1 ≤ i ≤ R) is a string of length C consisting of P, W, G, |, -, \, and /. The j-th character (1 ≤ j ≤ C) of Si describes how to skewer the dango in the cell located in the i-th row from the top and the j-th column from the left.

  • The j-th character of Si is the character | if you will make a beautiful stick of dangos using the dangos in that cell, the adjacent cell above, and the adjacent cell below.
  • The j-th character of Si is the character - if you will make a beautiful stick of dangos using the dangos in that cell, the adjacent cell to the left, and the adjacent cell to the right.
  • The j-th character of Si is the character \ if you will make a beautiful stick of dangos using the dangos in that cell, the touching cell left above, and the touching cell right below.
  • The j-th character of Si is the character / if you will make a beautiful stick of dangos using the dangos in that cell, the touching cell right above, and the touching cell left below.
  • Otherwise, the j-th character of Si is P, W, or G according the color of the dango in that cell, i.e. it is the same as the j-th character of Di.

제한

  • 3 ≤ R ≤ 500.
  • 3 ≤ C ≤ 500.
  • Di (1 ≤ i ≤ R) is a string of length C consisting of P, W, and G.

채점

Your score for this task is calculated in the following way.

We define four values S (denoting the assigned score), X, Y and Z as follows.

  • S = 15
  • X = 18000
  • Y = 19000
  • Z = 19120

Let N be the number of beautiful sticks of dangos you can make by your submission. Your score for the test case is calculated as follows.

  • If N < X, your score is 0.
  • If X ≤ N < Y, your score is \(\frac{N-X}{2(Y-X)} \times S\).
  • If Y ≤ N < Z, your score is \(\left(\frac{1}{2} + \frac{N-Y}{2(Z-Y)}\right) \times S\).
  • If Z ≤ N, your score is S .

However, your score for a test case is 0 if your output data is incorrect, i.e. you cannot make beautiful sticks of dangos according to the characters |-\/ in your output data, the characters P, W, or G in your output data conflict with the input data, or the format of your output data is wrong

예제 입력 1

3 4
PWGP
WGPW
GWPG

예제 출력 1

P-GP
WGP|
G-PG

In this sample, you make three beautiful sticks of dangos.

Note that you cannot make a beautiful stick of dangos using W G P, in this order.

예제 입력 2

3 4
PWWP
WWWW
PGGP

예제 출력 2

PWWP
W\/W
PGGP

In this sample, you make two beautiful sticks of dangos.

Visualizer

A visualizer is available for this task, which shows the overview of the input data or the output data in a visual way. You can download the visualizer from the contest system as an attachment file to this task.

To use the visualizer, you should open the attached dango2-visualizer.html by a web browser and choose or drag-and-drop the file. Note that the visualizer does not completely check the correctness of the format of the given file. It might not be executed correctly if the format of the input file is wrong. Also, it might not be executed correctly if the value of R or C exceeds the constraints.

제출할 수 있는 언어

Text

채점 및 기타 정보

  • 15점 이상을 획득해야 를 받는다.
  • 예제는 채점하지 않는다.