Getting TLE'd with O(nlogn) (2-sec)

Правка en4, от Codeforcer, 2021-05-02 13:45:19

I cannot figure out why this code is getting TLE'd despite of everything being under order and constraint. I knew those mod operations were costly so I optimized them but still no luck.

Problem : https://codeforces.me/contest/1466/problem/E

Code

Update : Resolved, It barely passed(1996 ms) after I changed some ll's to ints. Would still like to hear some advice or a good solution though!

Thanks!

Теги #goodbye2020, tle, div2e

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en5 Английский Codeforcer 2021-05-02 15:17:07 1655 Tiny change: '263 ms\n\n<spoil' -> '263 ms\n\n\n\n<spoil'
en4 Английский Codeforcer 2021-05-02 13:45:19 9 Tiny change: 'ely passed after I c' -> 'ely passed(1996 ms) after I c'
en3 Английский Codeforcer 2021-05-02 13:44:38 145 Tiny change: 'oiler>\n\nUpdate : Resolve' -> 'oiler>\n\n**Update** : Resolve'
en2 Английский Codeforcer 2021-05-02 13:28:53 0 (published)
en1 Английский Codeforcer 2021-05-02 13:28:36 2013 Initial revision (saved to drafts)