1262 : Painter
| 比对Compare | token 相同即通过。中间的空格、制表符、换行可多可少。Matching tokens pass. Extra spaces, tabs, or newlines between them are ignored. |
|---|---|
| 不同则错Differs | token 个数或内容不同即错误。23 与 2 3、02 与 2、2.0 与 2 均视为不同。A different token count or value is wrong. 23 vs 2 3, 02 vs 2, and 2.0 vs 2 all differ. |
| 输入Input | 标准输入,格式见题面。Standard input; format as in the statement. |
| 输出Output | 标准输出。Standard output. |
| 时间与内存Time and memory | 记这一份程序的 CPU 时间和内存峰值。题目上的时间限制、内存限制就是这一份的上限。The record is this program’s CPU time and peak memory. The limits on the problem apply to this one run. |
题目描述Description
Little G is a painter and is painting on a 2D plane. Each integral
point has a color character and the initial color characters for all
integral points are .(ASCII = 46). Now Little G is planning
to do some operations one by one, where each operation is in one of the
following three types:
- “Circle \(x\,y\,r\,col\)”, which means to draw a circle. Formally, change the color characters to \(col\) for these points \((u,v)\) that \((u-x)^2+(v-y)^2\le r^2\).
- “Rectangle \(x_1\,y_1\,x_2\,y_2\,col\)”, which means to draw a rectangle. Formally, change the color characters to \(col\) for these points \((u,v)\) that \(x_1 \le u \le x_2, y_1 \le v \le y_2\).
- “Render \(x_1\,y_1\,x_2\,y_2\)”, which means to render the image of given region. Formally, print the color characters for these points \((u,v)\) that \(x_1 \le u \le x_2, y_1 \le v \le y_2\).
But now, Little G is busy replying clarifications, so could you help him and be the painter?
输入格式Input
The first line contains one integers \(n\) (\(1\le n\le 2000\)), denoting the number of operations.
Following \(n\) lines each contains one operation, which is in one of the following three types:
- “Circle \(x\,y\,r\,col\,(0 \le |x|,|y|,r \le 10^9)\)”, which means to draw a circle. Formally, change the color characters to \(col\) for these points \((u,v)\) that \((u-x)^2+(v-y)^2\le r^2\).
- “Rectangle \(x_1\,y_1\,x_2\,y_2\,col\,(-10^9 \le x_1 \le x_2 \le 10^9, -10^9 \le y_1 \le y_2 \le 10^9)\)”, which means to draw a rectangle. Formally, change the color characters to \(col\) for these points \((u,v)\) that \(x_1 \le u \le x_2, y_1 \le v \le y_2\).
- “Render \(x_1\,y_1\,x_2\,y_2\,(-10^9 \le x_1 \le x_2 \le 10^9, -10^9 \le y_1 \le y_2 \le 10^9)\)”, which means to render the image of given region. Formally, print the color characters for these points \((u,v)\) that \(x_1 \le u \le x_2, y_1 \le v \le y_2\).
It is guaranteed that all of the \(x,y,r,x_1,y_1,x_2,y_2\) above are integers.
It is guaranteed that the sum of the rendering region areas(which equal \((x_2 - x_1 + 1)\times(y_2 - y_1 + 1)\)) doesn’t exceed \(10^4\), and that \(col\) denotes visible characters, whose ASCII codes are between \(33\) and \(126\).
输出格式Output
For each rendering operation “Render \(x_1\,y_1\,x_2\,y_2\)”, print \(y_2 - y_1 + 1\) lines each containing one string of length \(x_2 - x_1 + 1\), denoting the region image(from row \(y_2\) to row \(y_1\), and in each row from \(x_1\) to \(x_2\)).
样例Sample
出题Author
FUDAN