Simulate moving circular droplets that merge on contact with area-weighted position and velocity, and report the final count and last merge time.
Medium6SimulationMathGeometryNo attempts yetTime limit3sMemory limit256 MBYou simulate the motion of droplets in a plane. Each droplet is a circle of some size that moves at a constant velocity. The moment two circles touch, they agglomerate into a single circular droplet whose area is the sum of the two areas. The new droplet's center is the area weighted average of the two centers at the moment of contact, and its velocity is the area weighted average of the two velocities.

The figure illustrates the process. In the top panel, a droplet of radius 4 centered at (−14,0) moves with velocity (1,0) toward a stationary droplet of radius 3 centered at the origin. The two circles touch at time t=7.0, which is the middle panel.
At that moment the droplet of radius 4 is centered at (−7,0). The two areas are 16π and 9π, so the new droplet has area 25π and radius 5. The x coordinate of the agglomerated droplet is 2516⋅(−7.0)+259⋅0.0=−4.48 and the y coordinate is 2516⋅0.0+259⋅0.0=0.0. The same calculation gives the velocity (0.64,0).
Given the initial configuration, simulate the motion until no further agglomeration can occur. Report how many droplets remain and the time of the last agglomeration.
Every test satisfies the following:
The first line contains the original number of droplets N (2≤N≤100).
Each of the next N lines contains five integers x, y, vx, vy, r separated by spaces: the x coordinate of the center, the y coordinate of the center, the x component of the velocity, the y component of the velocity, and the radius. These satisfy −10000≤x,y,vx,vy≤10000 and 1≤r≤100.
Print a single line with two values k and t separated by one space. k is the number of droplets in the final configuration, and t is the time at which the final agglomeration occurred.
Round t to six decimal places and print exactly six digits after the decimal point. If no agglomeration occurs, k equals the original number of droplets and t is 0.000000.