服务器 n, m = 3, 4 s = [1, 2, 3] arr = [[2, 1], [3, 2], [3, 3], [1, 1]] def getClose(n):     res = float('inf&(835)#39;)     for i in s:         if i >= n:             res = min(res, i)     return res if res != float('inf&(835)#39;) else float('-inf&(835)#39;) arr = sorted(arr, key=lambda x: (-x[1], x[0])) res = 0 for i in range(len(arr)):     m = getClose(arr[i][0])     if arr[i][0] <= m:         res += arr[i][1]         s.pop(s.index(m)) print(res)