1686. Stone Game VI
Содержание
class Solution:
def stoneGameVI(self, aliceValues: List[int], bobValues: List[int]) -> int:
vals = [(a + b, i) for i, (a, b) in enumerate(zip(aliceValues, bobValues))]
vals.sort(reverse=True)
a = sum(aliceValues[i] for _, i in vals[::2])
b = sum(bobValues[i] for _, i in vals[1::2])
if a > b:
return 1
if a < b:
return -1
return 0