atcoder#AGC021C. [AGC021C] Tiling

[AGC021C] Tiling

Score : 900900 points

Problem Statement

Takahashi has an N×MN \times M grid, with NN horizontal rows and MM vertical columns. Determine if we can place AA 1×21 \times 2 tiles (11 vertical, 22 horizontal) and BB 2×12 \times 1 tiles (22 vertical, 11 horizontal) satisfying the following conditions, and construct one arrangement of the tiles if it is possible:

  • All the tiles must be placed on the grid.
  • Tiles must not stick out of the grid, and no two different tiles may intersect.
  • Neither the grid nor the tiles may be rotated.
  • Every tile completely covers exactly two squares.

Constraints

  • 1N,M10001 \leq N,M \leq 1000
  • 0A,B5000000 \leq A,B \leq 500000
  • NN, MM, AA and BB are integers.

Input

Input is given from Standard Input in the following format:

NN MM AA BB

Output

If it is impossible to place all the tiles, print NO. Otherwise, print the following:

YES

c11...c1Mc_{11}...c_{1M}

::

cN1...cNMc_{N1}...c_{NM}

Here, cijc_{ij} must be one of the following characters: ., <, >, ^ and v. Represent an arrangement by using each of these characters as follows:

  • When cijc_{ij} is ., it indicates that the square at the ii-th row and jj-th column is empty;
  • When cijc_{ij} is <, it indicates that the square at the ii-th row and jj-th column is covered by the left half of a 1×21 \times 2 tile;
  • When cijc_{ij} is >, it indicates that the square at the ii-th row and jj-th column is covered by the right half of a 1×21 \times 2 tile;
  • When cijc_{ij} is ^, it indicates that the square at the ii-th row and jj-th column is covered by the top half of a 2×12 \times 1 tile;
  • When cijc_{ij} is v, it indicates that the square at the ii-th row and jj-th column is covered by the bottom half of a 2×12 \times 1 tile.
3 4 4 2
YES
<><>
^<>^
v<>v

This is one example of a way to place four 1×21 \times 2 tiles and three 2×12 \times 1 tiles on a 3×43 \times 4 grid.

4 5 5 3
YES
<>..^
^.<>v
v<>.^
<><>v
7 9 20 20
NO