|
||||||||||
Colorful SegmentTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 419 Accepted Submission(s): 106 Special Judge Problem Description Additive color mixing: adding red to green yields yellow; adding red to blue yields magenta; adding green to blue yields cyan; adding all three primary colors together yields white. In three dimensional space, there are N segments. Their initial color is black. In the red light, they will turn red. In the green light, they will turn green. In the blue light, they will turn blue. In the red and green light, they will turn yellow. In the red and blue light, they will turn magenta. In the green and blue light, they will turn cyan. In the red, green and blue light, they will turn white. There are M light sources. They can transmit red, green or blue light. But the light they emitted only illuminate a small area. The ith( 1 ¡Ü i ¡Ü M ) light source is located at (xi, yi, zi) and it can illuminate an area of ellipsoidal with equation as follows. Under irradiation of the M light sources, segments will show a different color. You should calculate the length of the segment in different colors. Input The first line of the input is T (1 ¡Ü T ¡Ü 100), which stands for the number of test cases you need to solve. The first line of each case contains two integers N ,M (1 ¡Ü N, M ¡Ü 100), denoting the number of segments and light sources, respectively. For the next N lines, eac line describes one segment with six integers x1, y1, z1, x2, y2, z2( -10000 ¡Ü x1, y1, z1, x2, y2, z2 ¡Ü 10000) which are coordinates of the segment¡¯s ending. Then follows M lines. Each line begins with six integers xi, yi, zi, ai, bi, ci as mentioned above (-10000 ¡Ü xi, yi, zi ¡Ü 10000, 1 ¡Ü ai, bi, ci ¡Ü 10000). At the end of the line is a character being ¡®R¡¯,¡®G¡¯ or ¡®B¡¯. ¡®R¡¯ means the light source emits red light. ¡®G¡¯ means the light source emits green light. ¡®B¡¯ means the light source emits blue light. Output For each test case, you should output 8 lines, output the length of segment with color black, red, green, blue, yellow, magenta, cyan, white in order. See detailed format from the sample output. Answer will be considered as correct if their absolute error is less than 10-5. Sample Input
Sample Output
Source | ||||||||||
|