How to solve spoj COPSEQ?

Revision en1, by Nanami_chan, 2018-08-07 04:30:37

Problem link: here

The best way I could think of right now is factorizing using pollard rho and then do O(N*D) dp where D is number of divisors. Problem is D can be up to almost 10^5 for some highly composite numbers. Any help is appreciated, thanks!

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en4 English Nanami_chan 2018-08-08 04:15:15 369 Tiny change: 'ersion):\nGiven $n <= 10^5\n' -> 'ersion):\n\nGiven **n** <= 10^5\n'
en3 English Nanami_chan 2018-08-07 17:28:13 33 Tiny change: 'em link: [here](https' -> 'em link: [Here](https'
en2 English Nanami_chan 2018-08-07 17:26:47 322
en1 English Nanami_chan 2018-08-07 04:30:37 320 Initial revision (published)