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

[内容有误] 离线算法中的普通莫队算法模板代码出错 #4407

Closed
1 task done
kankii opened this issue Oct 19, 2022 · 1 comment · Fixed by #5151
Closed
1 task done

[内容有误] 离线算法中的普通莫队算法模板代码出错 #4407

kankii opened this issue Oct 19, 2022 · 1 comment · Fixed by #5151
Labels
Content Bug / 页面内容有误 Something isn't working help wanted / 需要帮助 Extra attention is needed

Comments

@kankii
Copy link

kankii commented Oct 19, 2022

请选择:

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

我正在访问这个页面

https://oiwiki.org/misc/mo-algo/

我发现页面有这样的问题

在模板给定的这段代码中

inline void move(int pos, int sign) {
  // update nowAns
}

void solve() {
  BLOCK_SIZE = int(ceil(pow(n, 0.5)));
  sort(querys, querys + m);
  for (int i = 0; i < m; ++i) {
    const query &q = querys[i];
    while (l > q.l) move(--l, 1);
    while (r < q.r) move(r++, 1);
    while (l < q.l) move(l++, -1);
    while (r > q.r) move(--r, -1);
    ans[q.id] = nowAns;
  }
}

中的

    while (r < q.r) move(r++, 1);
    while (r > q.r) move(--r, -1);

应更正为

    while (r < q.r) move(++r, 1);
    while (r > q.r) move(r--, -1);
@kankii kankii added Content Bug / 页面内容有误 Something isn't working help wanted / 需要帮助 Extra attention is needed labels Oct 19, 2022
@welcome
Copy link

welcome bot commented Oct 19, 2022

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

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.

1 participant