CF 2073K - Book Sorting

Before I begin writing the full editorial, I want to clarify one detail. For Codeforces 2073K - Book Sorting, could you confirm whether the books are represented as a permutation of numbers from 1 to n, or as arbitrary integers with possible duplicates?

CF 2073K - Book Sorting

Rating: 2900
Tags: -
Solve time: 37s
Verified: no

Solution

Before I begin writing the full editorial, I want to clarify one detail. For Codeforces 2073K - Book Sorting, could you confirm whether the books are represented as a permutation of numbers from 1 to n, or as arbitrary integers with possible duplicates? This affects how the optimal solution is approached.