## [Solution] Make Them Alike Solution Codechef

[Solution] Make Them Alike Solution Codechef You are given a permutation �P of length �N, an array �A of size �N, and an integer �M. Initially, 0≤��≤�0≤Ai≤M. Consider an array �′A′ obtained from �A by replacing all zeros in �A with positive integers less than equal to �M. The array �′A′ will then be transformed as follows, in �N steps: In the ��ℎith step, we set ��′=���′Ai′=APi′. The initial array �′A′ is said to be beautiful, if, after the transformation of �N steps, all elements of array �′A′ are equal. … Read more