N - 1 moves is the hint, split grid by diagonal
\nfrom collections import *\nimport heapq\n\nclass Solution:\n    def maxCollectedFruits(self, fruits: List[List[int]]) -> int:\n        n = len(fruits)\n      
```\nfrom collections import *\nimport heapq\n\nclass Solution:\n    def maxCollectedFruits(self, fruits: List[List[int]]) -> int:\n        n = len(fruits)\n        diag = 0\n        for i in range(n):\n            diag += fruits[i][i]\n        def topright():\n            dist = [[0] * n for _ in range(n)]\n            for i in range(n - 1, -1, -1):\n                for j in range(n):\n                    dist[i][j] = fruits[i][j]\n                    for di, dj in [(1, -1), (1, 0), (1, 1)]:\n                        x = i + di\n                        y = j + dj\n                        if not 0 <= x < n or not 0 <= y < n:\n                            continue\n                        if x == y and (x, y) != (n - 1, n - 1):\n                            continue\n                        if (i < j) != (x < y) and (x, y) != (n - 1, n - 1):\n                            continue\n                        dist[i][j] = max(dist[i][j], fruits[i][j] + dist[x][y])\n            return dist[0][n - 1]\n        def bottomleft():\n            dist = [[0] * n for _ in range(n)]\n            for j in range(n - 1, -1, -1):\n                for i in range(n):\n                    dist[i][j] = fruits[i][j]\n                    for di, dj in [(-1, 1), (0, 1), (1, 1)]:\n                        x = i + di\n                        y = j + dj\n                        if not 0 <= x < n or not 0 <= y < n:\n                            continue\n                        if x == y and (x, y) != (n - 1, n - 1):\n                            continue\n                        if (i < j) != (x < y) and (x, y) != (n - 1, n - 1):\n                            continue\n                        dist[i][j] = max(dist[i][j], fruits[i][j] + dist[x][y])\n            return dist[n - 1][0]\n        return diag + topright() + bottomleft() - 2 * fruits[n - 1][n - 1]\n```
['Python']