Pizza slice game

Write codeHard35 min

Your task

There is a circular pizza with 3n slices of given sizes. You and two friends pick in rounds: you pick a slice, then your friend Alice (always) takes the slice clockwise-adjacent to yours, then friend Bob takes the slice counter-clockwise-adjacent. This repeats n times until all slices are gone. Maximize the total size of the slices you pick. The list length is a multiple of 3, between 3 and 500.

Examples

max_pizza_slices(slices: list[int]) -> int
Example 1
Inputmax_pizza_slices([1, 2, 3, 4, 5, 6])
Output10