|시간 제한||메모리 제한||제출||정답||맞힌 사람||정답 비율|
|1 초||512 MB||15||6||5||41.667%|
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
/. 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.
|if you will make a beautiful stick of dangos using the dangos in that cell, the adjacent cell above, and the adjacent cell below.
-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.
\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.
/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.
Gaccording the color of the dango in that cell, i.e. it is the same as the j-th character of Di.
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.
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.
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
G in your output data conflict with the input data, or the format of your output data is wrong
3 4 PWGP WGPW GWPG
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.
3 4 PWWP WWWW PGGP
PWWP W\/W PGGP
In this sample, you make two beautiful sticks of dangos.
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.