WC '17 Contest 1 S1 - On the Rocks
View as PDFWoburn Challenge 2017-18 Round 1 - Senior Division

Two teams have just finished playing a riveting round of Canada's
national sport, curling, and it's time to tally up their scores! Team 
has 
 
 stones in play, with the 
 of them at a
distance of 
 
 cm away from the "button"
(the centre of the scoring ring). Meanwhile, Team 
 has 
 stones, with the 
 of them at a distance of 
 cm away from the button. No two stones are equidistant
from the button.
If there are no stones in play at all, neither team will score any
points. Otherwise, only the single team which owns the closest stone to
the button will score points. That team will score  point for each of
their stones which is closer to the button than all of the other team's
stones are. If the other team doesn't even have any stones in play, then
each of the scoring team's stones counts for a point.
Please help tally up the two teams' final scores! Note that at least one
of these two scores must be equal to .
Subtasks
In test cases worth  of the points, 
 and 
.
Input Specification
The first line of input consists of two space-separated integers,  and 
.
The next line consists of integers, .
The next line consists of integers, .
Output Specification
Output two space-separated integers, the number of points scored by
Teams  and 
 respectively.
Sample Input
2 4
205 44
33 146 14 45
Sample Output
0 2
Sample Explanation
Team  owns the closest stone to the button (their 
 one), so they'll
be the team scoring some points. In particular, their 
 and 
 stones
will count for 
 point each. On the other hand, Team 
's 
 and 
stones won't count for any points, as they're further from the button
than Team 
's 
 stone is.
Comments