内存限制:512 MB
时间限制:2 S
题面:Markdown
评测方式:文本比较
上传者:
提交:16
通过:5
**Red** is on a $2\cdot n$ grid, with some cells being red and others being white.
**Red** can initially choose a red cell, and at each step, can choose a red cell above, below, to the left, or to the right. When **Red** leaves a cell, the cell immediately turns white.
**Red** wants to know the maximum number of steps she can take.
If there are no initial red cells, please output $0$.
The first line contains a positive integer $n(1\leq n \leq 10^6)$.
The next two lines contain a $2\cdot n$ character matrix, consisting only of \`R' and \`W' characters. \`R' represents a red cell, and \`W' represents a white cell.
An integer — the maximum number of steps **Red** can take.