Good Array Codeforces Solution