P7284 [COCI 2020/2021 #4] Patkice II

Description

Netflix business staff want to make an adaptation series about the journey of three ducks. In Round 1 of COCI 20/21, the ducks were on a map of sea currents, and they traveled together. The starting island of the ducks is marked with `o`. The ducks can travel in four directions: west to east (`>`), east to west (`

Input Format

The first line contains two integers $r$ and $s$, representing the number of rows and columns of the map. The next $r$ lines each contain $s$ characters, each being one of `ov^.x`. It is guaranteed that there is exactly one `o` and one `x` on the map, and they are not adjacent.

Output Format

On the first line output $k$, the minimum number of characters that need to be changed. Then output $r$ lines, each containing $s$ characters, representing the modified map. If there are multiple valid maps, output any one of them.

Explanation/Hint

#### Constraints **This problem uses bundled evaluation, with O2 optimization enabled automatically.** | Subtask | Points | Constraints and Notes | | :----------: | :----------: | :----------: | | $1$ | $30$ | $3 \le r,s \le 20$ | | $2$ | $80$ | None | For $100\%$ of the testdata, $3 \le r,s \le 2000$. #### Scoring If, for all test cases in a subtask, the first line is correct, then you can get half of the points for that subtask. This problem uses an unofficial self-written [Special Judge](https://www.luogu.com.cn/paste/d4nbx1ua). You can also download it from the attachments. Hacks are welcome (you may send a private message or post directly). #### Notes **The points for this problem follow the original COCI setting, with a full score of $110$.** **Translated from [COCI2020-2021](https://hsin.hr/coci/) [CONTEST #4](https://hsin.hr/coci/contest4_tasks.pdf) _T5 Patkice II_.** Translated by ChatGPT 5