@bondoc, i also had the same concept and problem earlier. But according to the comments mentioned in the problem during the contest, the radius of the circle can increase after some interval. For similar figure you can refer to figure of Apollonian gasket. Also, see the first solution of lebron (link-CodeChef: Practical coding for everyone) he also used the same concept but with one difference as soon as the radius becomes so small that it is negligible, he starts to takes the reverse series again.
Can anyone post a nice link to better understand the concept of inversion ? There aren’t many tutorials about it clubbed with the programming category. Is it important?
if u see by descartes theorem…for example initially u are given 4 circles…
1 outer C1 and three inner circles C2 C3 C4…now to make a new circle C5…u will put curvatures of C1,C2,and C4 in descartes equation which will provide…two solutions…as it is quadratic in nature…therefore one solution is the new circle…what will be the other solution…the one which was already touching C2 C1 and C4…and what was that? C3 ryt…therefore …C(n) and C(n-2) are complement circles…u can see this by drawing …though the recurrence relation u guys made was easier to solve than this one.
I also have some doubts about precision I was lazy to check it by myself. I had different solutions passing different tests - and I am not really sure that one which passed all tests is most precise
You have to be very careful with your floating point calculations. I don’t think there was any test case in the original problem as brutal with precision as that (although I didn’t pass Subtask 2, so I don’t really know), but the second test case of Subtask 1 was hard with precision. I had to try multiple times to get my floating point calculations as precise as possible before I passed that test case.
Second test case of first subtask was probably wrong due to floating point errors. I also got WA on this test case for a long time until I finally fixed my floating point calculations and made them as precise as possible.
rb(i, 4, 2000) compute the radius of all circles from 5 till 2000. I also tried rb(i, 4, 2000000) and I still got wrong answer for subtask 1. I still couldn’t find the problem.