Two Permutations Codeforces Solution