192. RGB
time limit per test: 0.25
sec.
memory limit per test: 4096
KB
input: standard input
output: standard output
There are N segments on a plane (0<N<=300). Each segment is defined by coordinates of the end points (X_{i1}, Y_{i1}) and (X_{i2}, Y_{i2}) (i=1,2,...,N). All coordinates are in a range from 0 to 32000. No two segments have more than one common point. Each segment is painted in one of three colors: red (R), green (G), blue (B). All points of all segments are projected to the axis OX (projection is made parallel to the axis OY). Each projected point is painted in color of the point nearest to the axis OX. You have to find the total lengths of the projections painted in red (SR), green (SG) and blue (SB) colors.
Input
The first line contains natural number N. Each of the following N lines contains coordinates of the ends of the segments (4 integer delimited by a space) and the letter (R, G, B), determining the color of a segment.
Output
The first line must contain letter R and number SR delimited by a space. The second line must contain letter G and number SG. The third line must contain letter B and number SB. All numbers should be printed with precision 0.01.
Sample test(s)
Input
4
1 1 3 2 R
2 1 4 2 G
3 1 5 2 B
2 2 3 5 R
Output
R 1
G 1
B 2
Author:  German G. Narkaytis

Resource:  ACM International Collegiate Programming Contest 20032004
NorthEastern European Region, Southern Subregion

Date:  2003 October, 9

Server time: 20171124 13:56:30  Online Contester Team © 2002  2016. All rights reserved. 

