Codeforces Round 1133 (Div. 1, Div. 2) is coming soon! Register here. ×

Misa-Misa's blog

By Misa-Misa, history, 3 years ago, In English

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. (One based indexing)

Constraints:

n <= 3e5

  • Vote: I like it
  • +1
  • Vote: I do not like it

»
3 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Misa-Misa (previous revision, new revision, compare).