Two-robot cherry collection

Write codeHard45 minGoogle style

Your task

Two robots start at the top row of an m x n grid: robot A at column 0, robot B at column n-1. Each step both robots move down one row, and each may shift to an adjacent column (left, straight, or right). When a robot lands on a cell it collects its cherries; if both land on the same cell, the cherries are only counted once. Return the maximum cherries collected by the time both reach the bottom row. Constraints: 1 <= m, n <= 70, 0 <= cell <= 100.

Examples

cherry_pickup_two(grid: list[list[int]]) -> int
Example 1
Inputcherry_pickup_two([[3, 1, 1], [2, 5, 1], [1, 5, 5], [2, 1, 1]])
Output24