Avoid Fixed Points NOFIX Solution Codechef
Avoid Fixed Points NOFIX Solution Chef has a sequence of N integers A=[A1,A2,…,AN]. He can perform the following operation any number of times (possibly, zero): For example, if A=[5,3,4] and Chef selects K=2, then after the operation he can obtain one of the sequences [2-,5,3,4],[5,2-,3,4],[5,3,2-,4] or [5,3,4,2-]. Chef wants this sequence to satisfy the following condition: for each 1≤i≤∣A∣, Ai≠i. Here, ∣A∣ denotes the length of A. Help … Read more