Why does this code give TLE in Python?

Правка en1, от okay4869, 2023-12-29 14:25:52

TLE CODE:

https://codeforces.net/contest/1886/submission/239483379

Accepted Code:

https://codeforces.net/contest/1886/submission/239483485

Is it because of

ans*=i;ans%md
ans=(ans*i)%md

? If So can anyone explain the reason why one gives TLE but other is fine?

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский okay4869 2023-12-29 14:25:52 359 Initial revision (published)