Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[内容有误] string/manacher.md中样例代码和原文不一致 #3330

Closed
1 task done
CamberLoid opened this issue Jul 16, 2021 · 2 comments · Fixed by #3331
Closed
1 task done

[内容有误] string/manacher.md中样例代码和原文不一致 #3330

CamberLoid opened this issue Jul 16, 2021 · 2 comments · Fixed by #3331
Labels
Content Bug / 页面内容有误 Something isn't working help wanted / 需要帮助 Extra attention is needed

Comments

@CamberLoid
Copy link
Contributor

CamberLoid commented Jul 16, 2021

请选择:

  • 我正在着手修复这个问题

我正在访问这个页面

https://github.com/OI-wiki/OI-wiki/tree/master/docs/string/manacher.md

我发现页面有这样的问题

原文(英文翻译)中对d1[]计算的代码如下

vector<int> d1(n);
for (int i = 0, l = 0, r = -1; i < n; i++) {
    int k = (i > r) ? 1 : min(d1[l + r - i], r - i + 1);  // 这行
    while (0 <= i - k && i + k < n && s[i - k] == s[i + k]) {
        k++;
    }
    d1[i] = k--;
    if (i + k > r) {
        l = i - k;
        r = i + k;
    }
}

而 docs/string/manacher.md 的代码和原文有一些偏差
int k = (i > r) ? 1 : min(d1[l + r - i], r - i);

可能是这个偏差让自己写某裸题时WA了

请协助勘误, 谢谢.

以及OI-Wiki/i18n那边可以全文引用英文翻译?(狗头)

@CamberLoid CamberLoid added Content Bug / 页面内容有误 Something isn't working help wanted / 需要帮助 Extra attention is needed labels Jul 16, 2021
@welcome
Copy link

welcome bot commented Jul 16, 2021

感谢你对 OI Wiki 的关注!记得在 Issue 中表达清楚自己的意思哦~

@sshwy
Copy link
Member

sshwy commented Jul 16, 2021

@CamberLoid 来个pr?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content Bug / 页面内容有误 Something isn't working help wanted / 需要帮助 Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants