time limit per test: 0.25
memory limit per test: 4096
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 (Xi1, Yi1) and (Xi2, Yi2) (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.
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.
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.
1 1 3 2 R
2 1 4 2 G
3 1 5 2 B
2 2 3 5 R
|Author:||German G. Narkaytis
|Resource:||ACM International Collegiate Programming Contest 2003-2004
North-Eastern European Region, Southern Subregion
|Date:||2003 October, 9
|Server time: 2017-09-20 16:50:46||Online Contester Team © 2002 - 2016. All rights reserved.|