UVa 10823

From Algorithmist
Jump to navigation Jump to search

10823 - Of Circles and Squares[edit]

Summary[edit]

Given a set of geometric objects and query points, find the color of the query point.

Explanation[edit]

If the query point lies on any border, it is black (0,0,0). If it doesn't lie inside any object, it is white (255,255,255). Otherwise, it is the average color of all the object that this query point it is in. Make sure you handle rounding correctly and the special case (of border) and the problem should be fine.

Notes[edit]

  • You can solve this problem without using doubles at all.

Input[edit]

2
3 2
SQUARE 0 0 5 0 0 1
SQUARE 0 0 5 0 0 2
SQUARE 0 0 5 0 0 1
1 4
100 100
3 3
CIRCLE 0 0 5 10 10 10
SQUARE 1 1 5 255 10 10
CIRCLE 5 5 3 0 0 0
5 6
6 5
8 5

Output[edit]

Case 1:
(0, 0, 1)
(255, 255, 255)

Case 2:
(0, 0, 0)
(0, 0, 0)
(0, 0, 0)