这是 2026-10-23 的上一版评测(LiveCodeBench 最新 35 题)。最新的阶梯评测见 首页。
结果
Kimi K3.1 ProKimi
✓
通过
- 函数调用,官方测试全部通过判题
- 7.5k输出 token(含思考) ↓
- 94 秒延迟 ↓
- —最慢测试的 CPU 时间 ↓
- —峰值内存 ↓
- 6Pylint 问题 ↓
- 6.67Pylint 得分 ↑
- 13圈复杂度 ↓
- 77.4可维护性指数 ↑
- 18有效行
- 1SonarQube 问题 ↓
DeepSeek-V4.1-FlashDS-Flash
✓
通过
- 函数调用,官方测试全部通过判题
- 13.4k输出 token(含思考) ↓
- 75 秒延迟 ↓
- —最慢测试的 CPU 时间 ↓
- —峰值内存 ↓
- 12Pylint 问题 ↓
- 4.29Pylint 得分 ↑
- 11圈复杂度 ↓
- 75.5可维护性指数 ↑
- 22有效行
- 1SonarQube 问题 ↓
DeepSeek-V4-ProDS-Pro
✓
通过
- 函数调用,官方测试全部通过判题
- 27.9k输出 token(含思考) ↓
- 208 秒延迟 ↓
- —最慢测试的 CPU 时间 ↓
- —峰值内存 ↓
- 6Pylint 问题 ↓
- 7.27Pylint 得分 ↑
- 17圈复杂度 ↓
- 66.1可维护性指数 ↑
- 22有效行
- 1SonarQube 问题 ↓
↑ 越大越好,↓ 越小越好,有效行只描述代码长短。CPU 时间与内存只统计能区分性能的题(最慢答案扣除进程启动后仍 ≥ 0.1 秒),括号内为相对最快者的倍数(≥ 2 时标出)。静态质量按 arXiv:2610.19167 的口径(见 原理)。判题方法见 原理 › 判题。
代码
Kimi K3.1 Pro · 25 行
class Solution: def maxActiveSectionsAfterTrade(self, s: str) -> int: t = "1" + s + "1" # Compress t into alternating runs of identical characters. runs = [] i = 0 while i < len(t): j = i + 1 while j < len(t) and t[j] == t[i]: j += 1 runs.append((t[i], j - i)) i = j initial = s.count("1") answer = initial # An internal '1' run can be removed. Filling the resulting zero run # gives a net gain equal to the lengths of its two adjacent zero runs. for i in range(1, len(runs) - 1): if runs[i][0] == "1": gain = runs[i - 1][1] + runs[i + 1][1] answer = max(answer, initial + gain) return answer
DeepSeek-V4.1-Flash · 31 行
class Solution: def maxActiveSectionsAfterTrade(self, s: str) -> int: total_ones = s.count('1') # Augment with '1' at both ends. t = '1' + s + '1' # Run-length encode t. runs = [] prev = t[0] count = 1 for ch in t[1:]: if ch == prev: count += 1 else: runs.append((prev, count)) prev = ch count = 1 runs.append((prev, count)) best_gain = 0 # An internal '1' block is surrounded by '0' blocks. for i in range(1, len(runs) - 1): if runs[i][0] == '1': left_zero_count = runs[i - 1][1] right_zero_count = runs[i + 1][1] best_gain = max(best_gain, left_zero_count + right_zero_count) return total_ones + best_gain
DeepSeek-V4-Pro · 26 行
class Solution: def maxActiveSectionsAfterTrade(self, s: str) -> int: runs = [] i = 0 n = len(s) while i < n: c = s[i] j = i while j < n and s[j] == c: j += 1 runs.append((c, j - i)) i = j total_ones = 0 for c, length in runs: if c == '1': total_ones += length best_gain = 0 m = len(runs) for i in range(1, m - 1): if runs[i][0] == '1': # runs[i-1] and runs[i+1] are guaranteed to be '0' due to alternating runs best_gain = max(best_gain, runs[i - 1][1] + runs[i + 1][1]) return total_ones + best_gain