## CCO '98 P4 - Scoring Curling

View as PDF

Points: 7 (partial)
Time limit: 2.0s
Memory limit: 64M

Problem type
##### Canadian Computing Competition: 1998 Stage 2, Day 2, Problem 1

The sport of curling is played in ends. In an end, two teams throw eight rocks each toward a circular target. The centre of the target is called the tee. The team that scores is the team whose rock is closest to the tee. The score for that team is the number of rocks belonging to it that are closer to the tee than any other rock from the opposing team, and no more than six feet from the tee. Rocks within feet of the same distance to the tee are considered to be tied. A rock is not considered to be closer to the tee than a rock with which it is tied. If the nearest rocks for the two teams are tied or both more than six feet from the tee, the end is declared to be a blank end, and there is no score.

Assume that the tee is at the location whose coordinates are . The position of each rock is given as coordinate pairs where and are in feet. For each of several games you are to determine which team wins, and its score.

#### Input Specification

The input consists of a line containing an integer , followed by the information for ends of curling. For each end, the positions of the eight rocks for team are given followed by the positions of the eight rocks for team . Each position is given on one line, the first decimal number being the -coordinate and the second being the -coordinate.

#### Output Specification

For each end, write a line containing the name of the team that wins (A or B) followed by a space followed by its score. If no team wins, write BLANK END.

#### Sample Input

1
1.000 1.000
2.000 2.000
3.000 3.000
4.000 4.000
5.000 5.000
6.000 6.000
7.000 7.000
8.000 8.000
0.100 1.000
0.900 -0.900
8.000 -8.000
-7.000 7.000
6.000 5.000
5.000 4.000
4.000 5.000
0.000 0.000

#### Sample Output

B 3