Codeforces Round 292 (Div. 1)
B
Drazil and Tiles
Codeforces
未评级
原题
← AC →
翻译中…

Drazil created a following problem about putting $1 × 2$ tiles into an $*n* × *m*$ grid:

翻译中…

"There is a grid with some cells that are empty and some cells that are occupied. You should use $1 × 2$ tiles to cover all empty cells and no two tiles should cover each other. And you should print a solution about how to do it."

翻译中…

But Drazil doesn't like to write special checking program for this task. His friend, Varda advised him: "how about asking contestant only to print the solution when it exists and it is unique? Otherwise contestant may print 'Not unique' ".

翻译中…

Drazil found that the constraints for this task may be much larger than for the original task!

翻译中…

Can you solve this new problem?

翻译中…

Note that you should print 'Not unique' either when there exists no solution or when there exists several different solutions for the original task.

翻译中…

Input

翻译中…

The first line contains two integers $*n*$ and $*m*$ ($1 ≤ *n*, *m* ≤ 2000$).

翻译中…

The following $*n*$ lines describe the grid rows. Character '.' denotes an empty cell, and the character '*' denotes a cell that is occupied.

翻译中…

Output

翻译中…

If there is no solution or the solution is not unique, you should print the string "Not unique".

翻译中…

Otherwise you should print how to cover all empty cells with $1 × 2$ tiles. Use characters "<>" to denote horizontal tiles and characters "^v" to denote vertical tiles. Refer to the sample test for the output format example.

翻译中…

Note

翻译中…

In the first case, there are indeed two solutions:

翻译中…

<>^
^*v
v<>

翻译中…

and

翻译中…

^<>
v*^
<>v

翻译中…

so the answer is "Not unique".

翻译中…

样例

Input #1
3 3
...
.*.
...
Output #1
Not unique
InputCopy OutputCopy
Input #2
4 4
..**
*...
*.**
....
Output #2
<>**
*^<>
*v**
<><>
InputCopy OutputCopy
Input #3
2 4
*..*
....
Output #3
*<>*
<><>
InputCopy OutputCopy
Input #4
1 1
.
Output #4
Not unique
InputCopy OutputCopy
Input #5
1 1
*
Output #5
*
InputCopy OutputCopy
题目信息
题号
516B
时间限制
2 s
内存限制
256 MB

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。