How is this python code calculating large factorials so fast and without memory limit error?

Revision en1, by pritishn, 2020-10-13 22:49:58

Link to the problem : https://www.codechef.com/FCF32020/problems/PATHWAY
Link to the code : https://www.codechef.com/viewsolution/38865614

In this code , how can python compute factorials of (N+M) ( N+M is in the order of 10^5 ) so fast? Can anyone explain this ? How did the python interpreter optimize it ?

Tags #python

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English pritishn 2020-10-13 22:49:58 408 Initial revision (published)