[Solution] Good Permutations Solution Codechef

[Solution] Good Permutations Solution Codechef You are given two arrays �A and �B, each of size �N. Let �P denote a permutation length �N. The permutation �P is said to be good, if you can make an array �C where: ��=��+���Ci​=Ai​+BPi​​ or ��=��−���Ci​=Ai​−BPi​​, for all (1≤�≤�)(1≤i≤N); All elements of �C are equal. Out of the �!N! possible permutations, find the count of good permutations. Since the count can be huge, output it modulo 109+7109+7. Note that a permutation … Read more