I am trying to solve 611D - Новый год и древнее пророчество, I wrote 60357814 this solution. I think the Time Complexity of my solution is $$$O(n ^ 2\log{}n)$$$ but I am getting Time Limit Exceeded verdict. I want to know is my Time Complexity analysis is wrong because I saw many $$$O(n ^ 2\log{}n)$$$ solutions are accepted(like 15127310) but not mine.