NTHCIR - Editorial

Nice! Thanks :slight_smile:

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?

What do you mean by complement circle? Also how to do you prove that complement of nth circle is (n-2)th circle

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 :smiley: ā€¦though the recurrence relation u guys made was easier to solve than this one.

Yes, this is the recurrence I used in the testerā€™s solution. Then I simply found the general term of the linear recurrence.

1 Like

I also have some doubts about precision :slight_smile: 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 :smiley:

I think the point was to see if we could figure out Subtask 2 using our algebra skills AND our knowledge of Descartes formula from Google.

2 Likes

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.

It was funny when one of my solutions was passing ONLY second case of subtask 2 but failing other 3 :smiley:

What does rb(i, 4, 2000) do? If it loops i from 4 to 2000, that was probably the problem because for Subtask 1, I think N_i could be as big as 3000.

Precision takes a toll when you are taking square roots so many times!

the floating results must always be accepted within 1e-6 relative error.

@yash_15 i donā€™t get you, i tried casting the sqrt function to long double, didnā€™t work

The formulas(8) and (9) will be sufficient as mentioned in the wolfram link.

thanks, well explained.

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.

Nowhere it was mentioned that the solution will be accepted within 1e-6 relative errorā€¦

you have to print exactly upto 6 decimal placesā€¦

Why can we write

xn=xnāˆ’1+c1 as xn=nc1+C ?