Metro Loops

Back to Topic List

aszaloki     2025-08-04 14:36:18

Hi Kevin,

I think I have the solution for this problem, here is my result for the 3-case example:

-12.8668509365212 -1.62228364550705 12.4293509365212 6.80978364550705 -12.8668509365212 -1.62228364550705 12.4293509365212 6.80978364550705 -114.665820113442 -190.965312181508 11.1084918278825 10.273586924612

I've checked my results with an online visualizer and checked the distances, circle equations and it seems they are correct. Yet maybe I am wrong, of course.

Could you please check your algorithm?

If you want I can send you the link which describes the method I use for this type of Apollonius problem.

P.S: in the example case the first and second inputs are the same, but each of the results in the answer differ. Probably just a copy-paste bug.

P.S.2: When I try the test case the checker says that only 1 answer is expected instead of 64 (if my test input contains Q=16 cases)

Thanks in advance!

admin (Kevin)     2025-08-04 21:06:02
User avatar

Hi Adam - sorry about that! There indeed was a variable-naming mistake with the checker that woulnd't have allowed for proper checking and causing the "only 1 anwer expected" bug - that should be resolved now!

However, I'm not sure that the "example" values you provided are indeed correct for the example problem... See here for a visualization - it looks like loops having those centers would indeed pass through both stations, but they each cross over the boardwalk instead of being tangent to it.

aszaloki     2025-08-05 08:32:04

Hi Kevin,

hmm, thank you, I missed something somewhere, I keep on investigating.

Please login and solve 5 problems to be able to post at forum