Grok 3
変動分析 · 2026年 第12週
Grok 3 2026年 第12週 コード実行次元が 42.4 点上昇。主に位运算:判断2的幂与 bit count、二叉树序列化(稳定格式版)で得点
スコア比較
42.5
56.2
+13.7
| 次元 | 前回 | 今回 | 変動 |
|---|---|---|---|
| コード実行 | 22.5 | 64.9 | +42.4 |
| 知識総合 | 38.8 | 44.8 | +6 |
| 引用検証 | 64.5 | 83 | +18.5 |
| コストパフォーマンス | 13.9 | 21.1 | +7.2 |
| 安定性 | 54.2 | 31.7 | -22.5 |
| 可用性 | 100 | 100 | 0 |
失点 Top 5
浮点精度陷阱
66.7
0
-66.7
コード実行
exact_lines
STRICT
詳細証拠を展開
前回の回答
False
True
Raises `NameError: name 'math' is not defined`
**完整修正版(覆盖浮点精度及 import 边界)**:
```python
import math
0.1 + 0.2 == 0.3 # False
round(0.1 + 0.2, 1) == 0.3 # True
math.isclose(0.1 + 0.2, 0.3) # True
```
今回の回答
False
True
Raises NameError: name 'math' is not defined
**完整修正版:**
```python
import math
0.1 + 0.2 == 0.3 # False (浮点精度边界)
round(0.1 + 0.2, 1) == 0.3 # True
math.isclose(0.1 + 0.2, 0.3) # True (默认rel_tol=1e-09, abs_tol=0.0)
```
供应商加权评分
33.3
0
-33.3
知識総合
calc_with_tolerance
STRICT
詳細証拠を展開
前回の回答
### 原权重(准确率40%、稳定性25%、成本20%、接入难度15%)
- **A**:(9×0.4) + (7×0.25) + (5×0.2) + (8×0.15) = 3.6 + 1.75 + 1 + 1.2 = **7.55**
- **B**:(8×0.4) + (9×0.25) + (7×0.2) + (6×0.15) = 3.2 + 2.25 + 1.4 + 0.9 = **7.75**
- **C**:(7×0.4) + (8×0.25) + (9×0.2) + (7×0.15) = 2.8 + 2 + 1.8 + 1.05 = **7.65**
**排序**:B (7.75) > C (7.65) > A (7.55)。推荐**B**。
### 稳定性权重提升至35%(其他权重不变)
- **A**:(9×0.4) + (7×0.35) + (5×0.2) + (8×0.15) = 3.6 + 2.45 + 1 + 1.2 = **8.25**
- **B**:(8×0.4) + (9×0.35) + (7×0.2) + (6×0.15) = 3.2 + 3.15 + 1.4 + 0.9 = **8.65**
- **C**:(7×0.4) + (8×0.35) + (9×0.2) + (7×0.15) = 2.8 + 2.8 + 1.8 + 1.05 = **8.45**
**排序**:B (8.65) > C (8.45) > A (8.25)。**排序不变**。
今回の回答
### 原权重(准确率40%、稳定性25%、成本20%、接入难度15%)加权总分
- **A**:9×0.4 + 7×0.25 + 5×0.2 + 8×0.15 = 3.6 + 1.75 + 1 + 1.2 = **7.55**
- **B**:8×0.4 + 9×0.25 + 7×0.2 + 6×0.15 = 3.2 + 2.25 + 1.4 + 0.9 = **7.75**
- **C**:7×0.4 + 8×0.25 + 9×0.2 + 7×0.15 = 2.8 + 2 + 1.8 + 1.05 = **7.65**
**排序**:B (7.75) > C (7.65) > A (7.55)。推荐**B**。
### 稳定性权重提升至35%(其他权重不变)后加权总分
- **A**:9×0.4 + 7×0.35 + 5×0.2 + 8×0.15 = 3.6 + 2.45 + 1 + 1.2 = **8.25**
- **B**:8×0.4 + 9×0.35 + 7×0.2 + 6×0.15 = 3.2 + 3.15 + 1.4 + 0.9 = **8.65**
- **C**:7×0.4 + 8×0.35 + 9×0.2 + 7×0.15 = 2.8 + 2.8 + 1.8 + 1.05 = **8.45**
**排序**:B (8.65) > C (8.45) > A (8.25)。**排序不变**。
正则表达式编写
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|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$'
```
今回の回答
```python
pattern1 = r'^(?:\+86|0086)?1[0-9]{10}$'
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?)$'
```
代码输出:闭包
10
0
-10
コード実行
exact_lines
STRICT
詳細証拠を展開
前回の回答
[2, 2, 2]
今回の回答
[2, 2, 2]
Debug:事件监听泄漏
10
0
-10
コード実行
diff_patch_unit_test
STRICT
詳細証拠を展開
前回の回答
```javascript
const resizeHandler = () => {
console.log(window.innerWidth);
};
let isMounted = false;
function mount() {
if (!isMounted) {
window.addEventListener('resize', resizeHandler);
isMounted = true;
}
}
function unmount() {
if (isMounted) {
window.removeEventListener('resize', resizeHandler);
isMounted = false;
}
}
```
今回の回答
```javascript
let resizeHandler = null;
function mount() {
if (resizeHandler) return;
resizeHandler = () => {
console.log(window.innerWidth);
};
window.addEventListener('resize', resizeHandler);
}
function unmount() {
if (resizeHandler) {
window.removeEventListener('resize', resizeHandler);
resizeHandler = null;
}
}
```
得点 Top 5
位运算:判断2的幂与 bit count
20
100
+80
コード実行
python_unit_test
STRICT
詳細証拠を展開
前回の回答
```python
def is_power_of_2(n):
return n > 0 and (n & (n - 1)) == 0
def count_bits(n):
count = 0
while n:
n &= n - 1
count += 1
return count
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):
return n > 0 and (n & (n - 1)) == 0
def count_bits(n):
count = 0
while n:
count += 1
n &= n - 1
return count
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
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
def serialize(root):
if not root:
return "null"
return f"{root.val},{serialize(root.left)},{serialize(root.right)}"
def deserialize(data):
vals = data.split(',')
i = [0]
def helper():
if i[0] >= len(vals):
return None
val = vals[i[0]]
i[0] += 1
if val == "null":
return None
node = TreeNode(int(val))
node.left = helper()
node.right = helper()
return node
return helper()
```
今回の回答
```python
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
def serialize(root):
if not root:
return "null"
return f"{root.val},{serialize(root.left)},{serialize(root.right)}"
def deserialize(data):
vals = iter(data.split(','))
def helper():
val_str = next(vals)
if val_str == 'null':
return None
node = TreeNode(int(val_str))
node.left = helper()
node.right = helper()
return node
return helper()
```
全排列(去重 + 有序)
20
95
+75
コード実行
python_unit_test
STRICT
詳細証拠を展開
前回の回答
```python
def permute_unique(nums):
def backtrack(path, used, res):
if len(path) == len(nums):
res.append(path[:])
return
for i in range(len(nums)):
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, used, res)
path.pop()
used[i] = False
if not nums:
return [[]]
nums.sort()
res = []
backtrack([], [False] * len(nums), res)
return res
```
今回の回答
```python
from typing import List
def permute_unique(nums: List[int]) -> List[List[int]]:
nums.sort()
res = []
used = [False] * len(nums)
def backtrack(path):
if len(path) == len(nums):
res.append(path[:])
return
for i in range(len(nums)):
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
def load_and_apply(path):
try:
text = read_config(path)
config = parse_config(text)
apply_config(config)
return True
except FileNotFoundError:
print("配置文件未找到")
return False
except json.JSONDecodeError:
print("配置文件解析失败")
return False
except ValueError:
print("应用配置失败")
return False
finally:
print("配置加载流程结束")
```
今回の回答
```python
import json
def load_and_apply(path):
try:
text = read_config(path)
config = parse_config(text)
apply_config(config)
return True
except FileNotFoundError:
print(f"配置文件未找到: {path}")
return False
except json.JSONDecodeError:
print("配置文件解析失败: JSON格式错误")
return False
except ValueError:
print("应用配置失败: 配置值无效")
return False
finally:
print("配置加载流程结束")
```
数据流中位数
20
95
+75
コード実行
python_unit_test
STRICT
詳細証拠を展開
前回の回答
```python
import heapq
class MedianFinder:
def __init__(self):
self.small = [] # max-heap (negated)
self.large = [] # min-heap
def addNum(self, num: int) -> None:
if not self.small or num <= -self.small[0]:
heapq.heappush(self.small, -num)
else:
heapq.heappush(self.large, num)
# Balance heaps
if len(self.small) > len(self.large) + 1:
heapq.heappush(self.large, -heapq.heappop(self.small))
elif len(self.large) > len(self.small):
heapq.heappush(self.small, -heapq.heappop(self.large))
def findMedian(self) -> float:
if len(self.small) > len(self.large):
return -self.small[0]
return (-self.small[0] + self.large[0]) / 2.0
```
今回の回答
```python
import heapq
class MedianFinder:
def __init__(self):
self.small = [] # max-heap (negated)
self.large = [] # min-heap
def add_num(self, num: int) -> None:
if not self.small or num <= -self.small[0]:
heapq.heappush(self.small, -num)
else:
heapq.heappush(self.large, num)
# Balance heaps
if len(self.small) > len(self.large) + 1:
heapq.heappush(self.large, -heapq.heappop(self.small))
elif len(self.large) > len(self.small):
heapq.heappush(self.small, -heapq.heappop(self.large))
def find_median(self) -> float:
if len(self.small) > len(self.large):
return -self.small[0]
return (-self.small[0] + self.large[0]) / 2.0
```