Help Me With this Interesting problem on permutations.

Правка en1, от Misa-Misa, 2023-10-10 15:52:12

Problem

You are give a permutation of length n. Among all rotations of this permutation find out the one with maximum number of cycles.
Cycles here mean that cyles in the graph of permutation which contains edges from element->corresponding index.

Constraints:

n <= 3e5

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский Misa-Misa 2023-10-10 15:53:08 0 (published)
en2 Английский Misa-Misa 2023-10-10 15:52:43 21 Tiny change: 'ng index`.<br>\n####' -> 'ng index`. (One based indexing)<br>\n####'
en1 Английский Misa-Misa 2023-10-10 15:52:12 354 Initial revision (saved to drafts)