Warning: session_start(): open(/tmp/sess_3c97875c7da774af5694973ea0f73c63, O_RDWR) failed: No space left on device (28) in /data/wiki/inc/init.php on line 239

Warning: session_start(): Failed to read session data: files (path: ) in /data/wiki/inc/init.php on line 239

Warning: Cannot modify header information - headers already sent by (output started at /data/wiki/inc/init.php:239) in /data/wiki/inc/auth.php on line 430
Writing /data/wiki/data/cache/4/43994124a9168f34c03db2ff7cd35d94.captchaip failed

Warning: Cannot modify header information - headers already sent by (output started at /data/wiki/inc/init.php:239) in /data/wiki/inc/actions.php on line 38

Warning: Cannot modify header information - headers already sent by (output started at /data/wiki/inc/init.php:239) in /data/wiki/lib/tpl/dokuwiki/main.php on line 12
2020-2021:teams:manespace:最长上升子序列 [CVBB ACM Team]

用户工具

站点工具


2020-2021:teams:manespace:最长上升子序列

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录 前一修订版
后一修订版
前一修订版
2020-2021:teams:manespace:最长上升子序列 [2020/06/01 12:17]
intouchables [Solution 3 : 转LCS]
2020-2021:teams:manespace:最长上升子序列 [2020/06/04 15:53] (当前版本)
intouchables [Solution 4 : 据说可以用树状数组?]
行 78: 行 78:
 ==== Solution 3 : 转LCS ==== ==== Solution 3 : 转LCS ====
  
-顾名思义,将数组 $a$ 排序得到新数组 $b$,问题转化为求 $a,b$ 的最长公共子序列,长度分别为 $n,m$+顾名思义,将数组 $a$ 排序得到新数组 $b$,问题转化为求 $a,b$ 的**最长公共子序列**,长度分别为 $n,m$
  
-此处只给出其 $DP$ 状态转移方程,以 $dp[i][j]$ 表示 $a[i]$ 和 $b[j]$ 的LCS长度,状态转移方程 $dp[i][j] =$+此处只给出其 $DP$ 状态转移方程,以 $dp[i][j]$ 表示 $a[i]$ 和 $b[j]$ 的LCS长度,状态转移方程 $dp[i][j] =$
  
   0 ;(i == 0 || j == 0)   0 ;(i == 0 || j == 0)
行 88: 行 88:
 解的追踪(不予详解):设一标记数组 $tr[n][m]$ ,标记依据 $dp$ 方程设立,最后从 $tr[n][m]$ 回溯寻找 $a[i] == b[j]$的标记,压栈即可 解的追踪(不予详解):设一标记数组 $tr[n][m]$ ,标记依据 $dp$ 方程设立,最后从 $tr[n][m]$ 回溯寻找 $a[i] == b[j]$的标记,压栈即可
  
-+
 <​code>​ <​code>​
 for(int i = 1; i <= n; ++i){ for(int i = 1; i <= n; ++i){
行 122: 行 122:
 ==== Solution 4 : 据说可以用树状数组? ==== ==== Solution 4 : 据说可以用树状数组? ====
  
-<​del>​吓得我赶紧去学</​del> ​ 先前的[[树状数组]]有待完善...+树状数组可参考本队上一专题→[[树状数组]] 
 + 
 +<​del>​但是到考期了你懂的</​del>​ 
 + 
 +这里不讲了,也是 $O(nlogn)$ 的复杂度,需要自行查找吧
  
  
2020-2021/teams/manespace/最长上升子序列.1590985068.txt.gz · 最后更改: 2020/06/01 12:17 由 intouchables