Circle Drawing
Time limit3sMemory limit128 MB
Paint circles onto a grid, later circles overwriting earlier ones, then print the final color of every pixel.
- Level
Easy3 of 10
- Topics
- Simulation, Geometry, Implementation
- Solved
- No attempts yet
Problem
Graphics libraries usually provide functions for drawing primitive shapes such as lines, polygons, and circles. In this problem you will write a program that draws circles.
The canvas is a grid of by pixels. Each pixel holds a color from 0 to 9, and initially every pixel has color 0. Each pixel is treated as a small square with side length 1.
A circle with center and radius is the set of pixels that satisfy
Drawing a circle means setting the color of every pixel in this set to the circle's color. After drawing the given circles in order, output the color of every pixel on the canvas.
Input
The input contains the numbers , , , followed by groups of numbers , , , , giving the center coordinates, radius, and color of the -th circle. All numbers are separated by whitespace.
Output
Output lines of characters each, where the -th character of the -th line is the digit for the color of pixel .