#C3623. Grid Painter

    ID: 47071 Type: Default 1000ms 256MiB

Grid Painter

Grid Painter

You are given a grid of size (10 \times 10) filled with zeros. Your task is to process a series of drawing commands to update the grid. There are two types of drawing commands:

  1. Horizontal line: The command is of the form H x y length. This command draws a horizontal line with ones in the grid starting at coordinate ((x, y)) (with 0-indexed rows and columns) and continuing for length cells to the right.

  2. Vertical line: The command is of the form V x y length. This command draws a vertical line with ones in the grid starting at coordinate ((x, y)) (0-indexed) and continuing downwards for length cells.

A special command Q indicates the termination of the command sequence. When processing commands, once you encounter a command equal to Q, you must stop processing further commands (if any) and output the final state of the grid.

After processing the commands, print the grid row by row. Each row should be printed as a concatenated string of digits (without spaces), representing the state of that row.

inputFormat

The input consists of several lines, each containing a command. Each command is one of the following:

H x y length — draw a horizontal line starting at cell ((x, y)) with the specified length. • V x y length — draw a vertical line starting at cell ((x, y)) with the specified length. • Q — stop processing commands (any commands after this should be ignored).

All indices are 0-indexed and it is guaranteed that the drawing operations will not exceed the grid boundaries.

outputFormat

Print the final state of the (10 \times 10) grid after executing the commands. Output 10 lines; each line is a concatenated string of 10 digits (either 0 or 1) corresponding to that row of the grid.## sample

H 0 0 3
Q
1110000000

0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000

</p>