[Solution] Build Permutation solution codeforces

Build Permutation solution codeforces – A 00-indexed array 𝑎a of size 𝑛n is called good if for all valid indices 𝑖i (0≤𝑖≤𝑛−10≤i≤n−1), 𝑎𝑖+𝑖ai+i is a perfect square††. [Solution] Build Permutation solution codeforces Given an integer 𝑛n. Find a permutation‡‡ 𝑝p of [0,1,2,…,𝑛−1][0,1,2,…,n−1] that is good or determine that no such permutation exists. †† An integer 𝑥x is said to be a perfect square if there exists an integer 𝑦y such that 𝑥=𝑦2x=y2. ‡‡ An array 𝑏b is a permutation of … Read more