We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
When you know Moebius transformations and check that you can work in Fp (with ), it's quite simple but laborious.
Seems like no one succeded in Python before me (see leaderboard), so here a remark:
I at first used some nice and clean classes to encapsulate
Fp with its arithmetic operations
Complex arithmetics (operating on pairs eg of type Fp)
Moebius transforms with multiplication and power
Alas this solution was too slow for test cases 9ff, so i refactored it, completely removed any classes and subfunctions, to end up with simple (long!!) completely explicite formulas. This did it for all tests.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Down the Rabbit Hole
You are viewing a single comment's thread. Return to all comments →
When you know Moebius transformations and check that you can work in Fp (with ), it's quite simple but laborious.
Seems like no one succeded in Python before me (see leaderboard), so here a remark:
I at first used some nice and clean classes to encapsulate
Alas this solution was too slow for test cases 9ff, so i refactored it, completely removed any classes and subfunctions, to end up with simple (long!!) completely explicite formulas. This did it for all tests.