CHEFAXR - Editorial

My code n^3logn solution also gives TLE when i used Trie base based(with use of pointer).(I think it is impossible to pass a n^4 solution). I got frusteded but then i use Trie based solution with use of array only without use of pointer. And then magic happen and my solution pass like miracle but the time complexity is still n^3logn. But my time is far worse than a n^4 solution coded by my friend. Why this happen?? My both solution are here and here.

Problem link in practice not working

Practice link for this problem is not working.Please resolve this.

Please explain how CR=CB⊕CG⊕CY⊕CP works.

Please explain how CR=CB⊕CG⊕CY⊕CP works.

link to pratice https://www.codechef.com/problems/CHEFAXR

How to solve this question in O(N^2)??

For all who are asking why O(N^4 * 10) is been accepted! So answer is that there is a chance of weak test cases in 1< = T <= 10. May be all test cases would not able to cover N=70. otherwise in execution speed it impossible to get AC in (10^8 * 2) instruction according to the question!