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

[内容有误] 最长不下降子序列描述有误 #5163

Closed
1 task done
hhc0001 opened this issue Sep 30, 2023 · 3 comments · Fixed by #5265
Closed
1 task done

[内容有误] 最长不下降子序列描述有误 #5163

hhc0001 opened this issue Sep 30, 2023 · 3 comments · Fixed by #5265
Labels
Content Bug / 页面内容有误 Something isn't working help wanted / 需要帮助 Extra attention is needed

Comments

@hhc0001
Copy link
Contributor

hhc0001 commented Sep 30, 2023

请选择:

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

我正在访问这个页面

动态规划基础

我发现页面有这样的问题

首先,定义 $a_1 \dots a_n$ 为原始序列,$d$ 为当前的不下降子序列, $len$ 为子序列的长度,那么 $d_{len}$ 就是长度为 len 的不下降子序列末尾元素。

初始化:$d_1=a_1,len=1$。

应修改为

首先,定义 $a_1 \dots a_n$ 为原始序列,$d_i$ 为长度为 $i$ 的所有的上升子序列的末尾的数的最小值, $len$ 为当前搞出的最长不下降子序列的长度,那么 $d_{len}$ 就是长度为 $len$ 的不下降子序列末尾元素。

Reference

OI-wiki 中最长不下降子序列的参考资料的原文

@hhc0001 hhc0001 added Content Bug / 页面内容有误 Something isn't working help wanted / 需要帮助 Extra attention is needed labels Sep 30, 2023
@hhc0001
Copy link
Contributor Author

hhc0001 commented Sep 30, 2023

事实上在测了 一本通求最长不下降子序列的题目 的样例之后都没过,如图:

结果的截图

可以看到,这个算法输出的东西,连子序列都不是。

@LeoJacob
Copy link
Collaborator

LeoJacob commented Oct 7, 2023

同意 $O(n \log n)$ 算法的描述有问题。

除了准确性以外,该算法的表述类似“跟着我做 1 2 3 就做出来了”,对于初学者不友好。建议修改时按以下步骤展示:

  1. 描述 $d$ 数组的准确定义;
  2. 描述如何利用 $d$ 数组完成原有问题;
  3. 描述 $d$ 的单调性;
  4. 描述如何利用 $d$ 的单调性采用二分优化;
  5. 给出代码。

@hhc0001
Copy link
Contributor Author

hhc0001 commented Nov 12, 2023

接受,正在修改

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
2 participants