fix(basic/enumerate): met 数组开小了 (#5435)

fix:修改初始化met大小错误

met长度应为2*MAXN+1而不是2*MAXN
pull/5417/head^2
TheWash7 2024-03-01 13:03:38 +08:00 committed by GitHub
parent 909984b6fc
commit 7ff011ae67
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -78,7 +78,7 @@ author: Early0v0, frank-xjh, Great-designer, ksyx, qiqistyle, Tiphereth-A , Sais
=== "C++"
```cpp
bool met[MAXN * 2];
bool met[MAXN * 2 + 1];
memset(met, 0, sizeof(met));
for (int i = 0; i < n; ++i) {
if (met[MAXN - a[i]]) ++ans;
@ -88,7 +88,7 @@ author: Early0v0, frank-xjh, Great-designer, ksyx, qiqistyle, Tiphereth-A , Sais
=== "Python"
```python
met = [False] * MAXN * 2
met = [False] * (MAXN * 2 + 1)
for i in range(n):
if met[MAXN - a[i]]:
ans += 1