Блог пользователя Misa-Misa

Автор Misa-Misa, история, 8 месяцев назад, По-английски

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

  • Проголосовать: нравится
  • +1
  • Проголосовать: не нравится

»
8 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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