这是 2026-10-23 的上一版评测(LiveCodeBench 最新 35 题)。最新的阶梯评测见 首页。
结果
Kimi K3.1 ProKimi
✓
通过
- 函数调用,官方测试全部通过判题
- 6.5k输出 token(含思考) ↓
- 80 秒延迟 ↓
- 0.14 秒(最快)最慢测试的 CPU 时间 ↓
- 16 MB峰值内存 ↓
- 6Pylint 问题 ↓
- 6.84Pylint 得分 ↑
- 9圈复杂度 ↓
- 78.3可维护性指数 ↑
- 22有效行
- 1SonarQube 问题 ↓
DeepSeek-V4.1-FlashDS-Flash
✓
通过
- 函数调用,官方测试全部通过判题
- 3.5k输出 token(含思考) ↓
- 19 秒延迟 ↓
- 0.14 秒最慢测试的 CPU 时间 ↓
- 16 MB峰值内存 ↓
- 7Pylint 问题 ↓
- 6.50Pylint 得分 ↑
- 11圈复杂度 ↓
- 52.8可维护性指数 ↑
- 20有效行
- 1SonarQube 问题 ↓
DeepSeek-V4-ProDS-Pro
✓
通过
- 函数调用,官方测试全部通过判题
- 35.1k输出 token(含思考) ↓
- 259 秒延迟 ↓
- 1.24 秒(9.1×)最慢测试的 CPU 时间 ↓
- 16 MB峰值内存 ↓
- 10Pylint 问题 ↓
- 7.67Pylint 得分 ↑
- 21圈复杂度 ↓
- 64.4可维护性指数 ↑
- 45有效行
- 2SonarQube 问题 ↓
↑ 越大越好,↓ 越小越好,有效行只描述代码长短。CPU 时间与内存只统计能区分性能的题(最慢答案扣除进程启动后仍 ≥ 0.1 秒),括号内为相对最快者的倍数(≥ 2 时标出)。静态质量按 arXiv:2610.19167 的口径(见 原理)。判题方法见 原理 › 判题。
代码
Kimi K3.1 Pro · 35 行
from typing import List class Solution: def minimumCost(self, nums: List[int], cost: List[int], k: int) -> int: n = len(nums) prefix_nums = [0] * (n + 1) prefix_cost = [0] * (n + 1) for i in range(n): prefix_nums[i + 1] = prefix_nums[i] + nums[i] prefix_cost[i + 1] = prefix_cost[i] + cost[i] # dp[start]: minimum cost for nums[start:], assuming the first # subarray of this suffix has subarray index 1. dp = [0] * (n + 1) total_cost = prefix_cost[n] for start in range(n - 1, -1, -1): best = float("inf") for end in range(start + 1, n + 1): # First subarray is nums[start:end], with index 1. first = ( (prefix_nums[end] + k) * (prefix_cost[end] - prefix_cost[start]) ) # Every subarray in dp[end] shifts its index up by one, # adding k times the total cost sum of that suffix. shift = k * (total_cost - prefix_cost[end]) best = min(best, first + dp[end] + shift) dp[start] = best return dp[0]
DeepSeek-V4.1-Flash · 27 行
from typing import List class Solution: def minimumCost(self, nums: List[int], cost: List[int], k: int) -> int: n = len(nums) pref_nums = [0] * (n + 1) pref_cost = [0] * (n + 1) for i in range(1, n + 1): pref_nums[i] = pref_nums[i - 1] + nums[i - 1] pref_cost[i] = pref_cost[i - 1] + cost[i - 1] total_cost = pref_cost[n] INF = 10**30 dp = [INF] * (n + 1) dp[0] = 0 for i in range(1, n + 1): for left in range(i): current = dp[left] + pref_nums[i] * (pref_cost[i] - pref_cost[left]) if left > 0: current += k * (total_cost - pref_cost[left]) dp[i] = min(dp[i], current) return dp[n] + k * total_cost
DeepSeek-V4-Pro · 61 行
from typing import List class Solution: def minimumCost(self, nums: List[int], cost: List[int], k: int) -> int: n = len(nums) # Prefix sums P = [0] * (n + 1) # nums prefix C = [0] * (n + 1) # cost prefix for i in range(n): P[i + 1] = P[i] + nums[i] C[i + 1] = C[i] + cost[i] INF = 10**30 prev = [INF] * (n + 1) prev[0] = 0 ans = INF # m = number of subarrays for m in range(1, n + 1): cur = [INF] * (n + 1) hull = [] # points (C[s], prev[s]) on lower convex hull for t in range(m, n + 1): s = t - 1 y = prev[s] if y < INF: x = C[s] # Add point to lower convex hull while len(hull) >= 2: x1, y1 = hull[-2] x2, y2 = hull[-1] # Remove middle point if it is not on lower hull if (x2 - x1) * (y - y2) - (y2 - y1) * (x - x2) <= 0: hull.pop() else: break hull.append((x, y)) q = P[t] + k * m # Values y - q * x are unimodal on the lower hull. lo, hi = 0, len(hull) - 1 while lo < hi: mid = (lo + hi) // 2 v1 = hull[mid][1] - q * hull[mid][0] v2 = hull[mid + 1][1] - q * hull[mid + 1][0] if v1 <= v2: hi = mid else: lo = mid + 1 best = hull[lo][1] - q * hull[lo][0] cur[t] = q * C[t] + best prev = cur if prev[n] < ans: ans = prev[n] return ans