这是 2026-10-23 的上一版评测(LiveCodeBench 最新 35 题)。最新的阶梯评测见 首页。
结果
Kimi K3.1 ProKimi
✓
通过
- 函数调用,官方测试全部通过判题
- 15.2k输出 token(含思考) ↓
- 199 秒延迟 ↓
- —最慢测试的 CPU 时间 ↓
- —峰值内存 ↓
- 7Pylint 问题 ↓
- 8.16Pylint 得分 ↑
- 31圈复杂度 ↓
- 66.5可维护性指数 ↑
- 39有效行
- 2SonarQube 问题 ↓
DeepSeek-V4.1-FlashDS-Flash
✓
通过
- 函数调用,官方测试全部通过判题
- 13.9k输出 token(含思考) ↓
- 79 秒延迟 ↓
- —最慢测试的 CPU 时间 ↓
- —峰值内存 ↓
- 8Pylint 问题 ↓
- 8.43Pylint 得分 ↑
- 43圈复杂度 ↓
- 58.9可维护性指数 ↑
- 52有效行
- 2SonarQube 问题 ↓
DeepSeek-V4-ProDS-Pro
✓
通过
- 函数调用,官方测试全部通过判题
- 50.8k输出 token(含思考) ↓
- 388 秒延迟 ↓
- —最慢测试的 CPU 时间 ↓
- —峰值内存 ↓
- 10Pylint 问题 ↓
- 8.41Pylint 得分 ↑
- 47圈复杂度 ↓
- 56.7可维护性指数 ↑
- 65有效行
- 2SonarQube 问题 ↓
↑ 越大越好,↓ 越小越好,有效行只描述代码长短。CPU 时间与内存只统计能区分性能的题(最慢答案扣除进程启动后仍 ≥ 0.1 秒),括号内为相对最快者的倍数(≥ 2 时标出)。静态质量按 arXiv:2610.19167 的口径(见 原理)。判题方法见 原理 › 判题。
代码
Kimi K3.1 Pro · 58 行
from typing import List class Solution: def maxProduct(self, nums: List[int], k: int, limit: int) -> int: total = sum(nums) if k < -total or k > total: return -1 offset = total mask = (1 << (2 * total + 1)) - 1 # Products greater than limit can share one state. Such a product can # only remain overflowed, or become 0 after multiplying by zero. over = limit + 1 size = over + 1 # even[p] / odd[p] store a bitset of alternating sums for nonempty # subsequences of even / odd length whose (capped) product is p. even = [0] * size odd = [0] * size for x in nums: old_even, old_odd = even, odd even = old_even.copy() odd = old_odd.copy() next_product = [0] * size if x: for p in range(size): if p == over: next_product[p] = over else: value = p * x next_product[p] = value if value <= limit else over for p in range(size): q = next_product[p] bits = old_even[p] if bits: # x is appended at an even index, so it is added. odd[q] |= (bits << x) & mask bits = old_odd[p] if bits: # x is appended at an odd index, so it is subtracted. even[q] |= bits >> x # Start a new subsequence containing only x. singleton_product = x if x <= limit else over odd[singleton_product] |= 1 << (offset + x) target = 1 << (offset + k) for product in range(limit, -1, -1): if (even[product] & target) or (odd[product] & target): return product return -1
DeepSeek-V4.1-Flash · 77 行
from typing import List class Solution: def maxProduct(self, nums: List[int], k: int, limit: int) -> int: total = sum(nums) if k < -total or k > total: return -1 offset = total length = 2 * total + 1 mask = (1 << length) - 1 target_bit = 1 << (offset + k) # DP for positive products only. # dp0[p] / dp1[p]: bitset of reachable alternating sums # for product p and current subsequence length parity 0 / 1. dp0 = [0] * (limit + 1) dp1 = [0] * (limit + 1) for x in nums: if x == 0 or x > limit: continue old0, old1 = dp0, dp1 ndp0 = old0[:] ndp1 = old1[:] # Start a new subsequence with x. ndp1[x] |= 1 << (offset + x) max_product = limit // x for p in range(1, max_product + 1): np = p * x s0 = old0[p] if s0: ndp1[np] |= (s0 << x) & mask s1 = old1[p] if s1: ndp0[np] |= s1 >> x dp0, dp1 = ndp0, ndp1 for p in range(limit, 0, -1): if (dp0[p] & target_bit) or (dp1[p] & target_bit): return p # Check whether a valid zero-product subsequence exists. # A zero-product subsequence must contain at least one zero. dp = [[0, 0], [0, 0]] dp[0][0] = 1 << offset # empty subsequence: used_zero = 0, parity = 0, sum = 0 for x in nums: ndp = [[dp[0][0], dp[0][1]], [dp[1][0], dp[1][1]]] for used_zero in (0, 1): for parity in (0, 1): bits = dp[used_zero][parity] if not bits: continue if parity == 0: shifted = (bits << x) & mask else: shifted = bits >> x new_used_zero = 1 if (used_zero == 1 or x == 0) else 0 new_parity = 1 - parity ndp[new_used_zero][new_parity] |= shifted dp = ndp if (dp[1][0] & target_bit) or (dp[1][1] & target_bit): return 0 return -1
DeepSeek-V4-Pro · 90 行
from typing import List class Solution: def maxProduct(self, nums: List[int], k: int, limit: int) -> int: total = sum(nums) if abs(k) > total: return -1 offset = total over = limit + 1 L = limit + 2 # product states: 0..limit, and over # dp_even[p] / dp_odd[p]: bitset of reachable alternating sums # for non-empty subsequences with selected length even/odd. dp_even = [0] * L dp_odd = [0] * L for x in nums: new_even = dp_even[:] new_odd = dp_odd[:] if x == 0: # Start a subsequence with this zero. new_odd[0] |= 1 << offset # Append this zero to any existing subsequence. all_even = 0 all_odd = 0 for p in range(L): if dp_even[p]: all_even |= dp_even[p] if dp_odd[p]: all_odd |= dp_odd[p] new_odd[0] |= all_even new_even[0] |= all_odd else: # Start a subsequence with this positive number. if x <= limit: new_odd[x] |= 1 << (offset + x) else: new_odd[over] |= 1 << (offset + x) # Product 0 stays 0 after taking a positive number. bits = dp_even[0] if bits: new_odd[0] |= bits << x bits = dp_odd[0] if bits: new_even[0] |= bits >> x max_p = limit // x # Products that remain within the limit. for p in range(1, max_p + 1): bits = dp_even[p] if bits: new_odd[p * x] |= bits << x bits = dp_odd[p] if bits: new_even[p * x] |= bits >> x # Products that exceed the limit. bucket_even = 0 bucket_odd = 0 for p in range(max_p + 1, limit + 1): if dp_even[p]: bucket_even |= dp_even[p] if dp_odd[p]: bucket_odd |= dp_odd[p] if dp_even[over]: bucket_even |= dp_even[over] if dp_odd[over]: bucket_odd |= dp_odd[over] if bucket_even: new_odd[over] |= bucket_even << x if bucket_odd: new_even[over] |= bucket_odd >> x dp_even, dp_odd = new_even, new_odd target_bit = 1 << (offset + k) for p in range(limit, -1, -1): if (dp_even[p] & target_bit) or (dp_odd[p] & target_bit): return p return -1