豆包 Pro

変動分析 · 2026年 第12週

豆包 Pro 2026年 第12週 コード実行次元が 42.4 点上昇。主に二叉树序列化(稳定格式版)、Debug:DFS 环检测で得点

スコア比較

50.9 67.0 +16.1
次元 前回 今回 変動
コード実行 23.2 65.6 +42.4
知識総合 38.8 49.6 +10.8
引用検証 62.3 77.4 +15.1
コストパフォーマンス 71 88 +17
安定性 54.5 34.7 -19.8
可用性 100 99 -1

失点 Top 5

浮点精度陷阱
66.7 0 -66.7
コード実行 exact_lines STRICT
詳細証拠を展開
前回の回答
False True True 完整修正版代码(修复浮点数精度比较逻辑,补全依赖导入): ```python import math # 浮点数相等比较正确写法1:指定精度四舍五入后比较 print(round(0.1 + 0.2, 1) == 0.3) # 浮点数相等比较正确写法2:使用官方推荐的近似比较方法(适配更多边界场景) print(math.isclose(0.1 + 0.2, 0.3)) ```
今回の回答
False True True ### 完整修正版代码(覆盖浮点数精度边界,适配通用比较场景) ```python import math # 写法1:固定小数位精度比较,适合明确精度要求的场景 res1 = round(0.1 + 0.2, 1) == 0.3 # 写法2:通用浮点数接近判断,适配极小数、大数等更多边界场景 res2 = math.isclose(0.1 + 0.2, 0.3) ```
正则表达式编写
20 0 -20
コード実行 python_unit_test
詳細証拠を展開
前回の回答
```python pattern1 = r'^(\+86|0086)?1[3-9]\d{9}$' pattern2 = r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$' pattern3 = r'^((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$' ```
今回の回答
```python pattern1 = r'^(?:\+86|0086)?1[3-9]\d{9}$' pattern2 = r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$' pattern3 = r'^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)$' ```
代码输出:闭包
10 0 -10
コード実行 exact_lines STRICT
詳細証拠を展開
前回の回答
[2, 2, 2]
今回の回答
[2, 2, 2]
Debug:事件监听泄漏
10 0 -10
コード実行 diff_patch_unit_test STRICT
詳細証拠を展開
前回の回答
```javascript let resizeHandler = null; function mount() { // 避免重复注册监听器 if (resizeHandler) return; resizeHandler = () => { console.log(window.innerWidth); }; window.addEventListener('resize', resizeHandler); } function unmount() { if (!resizeHandler) return; window.removeEventListener('resize', resizeHandler); // 重置标记,允许下次重新注册 resizeHandler = null; } ```
今回の回答
```javascript const handleResize = () => { console.log(window.innerWidth); }; function mount() { // 先移除再添加,避免意外未调用unmount时重复注册 window.removeEventListener('resize', handleResize); window.addEventListener('resize', handleResize); } function unmount() { window.removeEventListener('resize', handleResize); } ```
根因判断与证据边界
66.7 66.5 -0.2
引用検証 citation_grounded
詳細証拠を展開
前回の回答
### 已较强支持(doc_id: sec-1、sec-2、sec-3) 当前最可能的主根因:2026-03-18 13:52被开启的支付服务“优惠券预校验”开关触发了大量Redis未命中回源(事故期间64%的优惠券预校验请求未命中Redis触发回源),回源逻辑同步访问订单库、营销库导致数据库CPU飙升、支付请求耗时大幅上涨,最终引发支付API高5xx错误率,关闭该开关后各项指标逐步恢复正常。 --- ### 尚未证实(doc_id: sec-3) 1. 2026-03-18 13:48部署的新版本引入低效SQL是事故直接根因; 2. 2026-03-18 13:48部署的版本变更扩大了本次问题的暴露面; 3. 本次事故中“优惠券预校验”开关对故障的影响不大。
今回の回答
### 已较强支持 主根因:支付服务“优惠券预校验”开关于2026-03-18 13:52开启后,触发大量Redis未命中回源,回源逻辑同步访问订单库、营销库导致数据库CPU过载,最终引发支付API 5xx错误率升高、订单创建耗时飙升等事故。 对应doc_id:sec-1、sec-2、sec-3 ### 尚未证实 1. 2026-03-18 13:48部署的新版本引入低效SQL是事故直接根因 2. 2026-03-18 13:48的版本变更扩大了本次事故的问题暴露面 3. “优惠券预校验”配置开关对本次事故影响不大 对应doc_id:sec-3

得点 Top 5

二叉树序列化(稳定格式版)
10 95 +85
コード実行 python_unit_test STRICT
詳細証拠を展開
前回の回答
```python class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right def serialize(root): res = [] def dfs(node): if not node: res.append("None") return res.append(str(node.val)) dfs(node.left) dfs(node.right) dfs(root) return ",".join(res) def deserialize(data): arr = data.split(",") def dfs(): cur = arr.pop(0) if cur == "None": return None node = TreeNode(int(cur)) node.left = dfs() node.right = dfs() return node return dfs() ```
今回の回答
```python class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right def serialize(root) -> str: res = [] def dfs(node): if not node: res.append("#") return res.append(str(node.val)) dfs(node.left) dfs(node.right) dfs(root) return ",".join(res) def deserialize(data) -> TreeNode: arr = data.split(",") def dfs(): cur = arr.pop(0) if cur == "#": return None node = TreeNode(int(cur)) node.left = dfs() node.right = dfs() return node return dfs() ```
Debug:DFS 环检测
10 95 +85
コード実行 diff_patch_unit_test STRICT
詳細証拠を展開
前回の回答
```python def has_cycle(graph): visited = set() # 存储已经完全处理完毕的节点 on_stack = set() # 存储当前递归栈中的节点(当前路径上的节点) def dfs(node): # 节点在当前递归栈中,说明找到了环 if node in on_stack: return True # 节点已经处理完毕,无环 if node in visited: return False # 加入当前递归栈 on_stack.add(node) # 遍历所有邻居 for nei in graph.get(node, []): if dfs(nei): return True # 所有邻居处理完毕,移出递归栈,标记为已完全处理 on_stack.remove(node) visited.add(node) return False # 遍历所有节点处理非连通图 for n in graph: if dfs(n): return True return False ```
今回の回答
```python def has_cycle(graph): visited = set() # 记录所有已完全访问过的节点 in_stack = set() # 记录当前递归栈中的节点 def dfs(node): if node in in_stack: # 当前递归路径重复访问节点,存在环 return True if node in visited: # 该节点已经处理完毕且无环,无需重复处理 return False visited.add(node) in_stack.add(node) for nei in graph.get(node, []): if dfs(nei): return True # 回溯:当前节点所有邻居处理完毕,移出递归栈 in_stack.remove(node) return False for n in graph: if dfs(n): return True return False ```
位运算:判断2的幂与 bit count
20 100 +80
コード実行 python_unit_test STRICT
詳細証拠を展開
前回の回答
### 完整代码 ```python def is_power_of_2(n): # 2的幂必须是正整数,且二进制只有1个1,n & (n-1)会消掉唯一的1结果为0 return n > 0 and (n & (n - 1)) == 0 def count_bits(n): cnt = 0 while n: # 每次消掉最后一个1,计数加1 n &= n - 1 cnt += 1 return cnt # 测试用例 print(is_power_of_2(0)) print(is_power_of_2(8)) print(is_power_of_2(12)) print(count_bits(15)) ``` ### 实际输出 ``` False True False 4 ```
今回の回答
### 完整代码 ```python def is_power_of_2(n): if n <= 0: return False return (n & (n - 1)) == 0 def count_bits(n): cnt = 0 while n: n &= n - 1 cnt += 1 return cnt print(is_power_of_2(0)) print(is_power_of_2(8)) print(is_power_of_2(12)) print(count_bits(15)) ``` ### 实际输出 ``` False True False 4 ```
全排列(去重 + 有序)
20 95 +75
コード実行 python_unit_test STRICT
詳細証拠を展開
前回の回答
```python def permute_unique(nums): if not nums: return [[]] nums.sort() res = [] n = len(nums) used = [False] * n def backtrack(path): if len(path) == n: res.append(path.copy()) return for i in range(n): if used[i]: continue if i > 0 and nums[i] == nums[i-1] and not used[i-1]: continue used[i] = True path.append(nums[i]) backtrack(path) path.pop() used[i] = False backtrack([]) return res ```
今回の回答
```python def permute_unique(nums): if not nums: return [[]] nums.sort() res = [] n = len(nums) used = [False] * n def backtrack(path): if len(path) == n: res.append(path.copy()) return for i in range(n): if used[i]: continue if i > 0 and nums[i] == nums[i-1] and not used[i-1]: continue used[i] = True path.append(nums[i]) backtrack(path) path.pop() used[i] = False backtrack([]) return res ```
异常处理链
10 85 +75
コード実行 python_unit_test STRICT
詳細証拠を展開
前回の回答
```python import json import logging def load_and_apply(path): try: text = read_config(path) config = parse_config(text) apply_config(config) return True except FileNotFoundError: logging.error(f"配置文件{path}不存在,读取失败") return False except json.JSONDecodeError: logging.error("配置文件JSON格式错误,解析失败") return False except ValueError: logging.error("配置内容校验失败,应用出错") return False finally: print("配置加载流程结束") ```
今回の回答
```python import json import logging def load_and_apply(path): try: text = read_config(path) config = parse_config(text) apply_config(config) return True except FileNotFoundError: logging.error(f"配置文件{path}不存在,读取失败") return False except json.JSONDecodeError: logging.error("配置内容格式非法,JSON解析失败") return False except ValueError: logging.error("配置参数校验不通过,应用失败") return False finally: print("配置加载流程结束") ```
変動ランキングに戻る