@@ -1516,8 +1516,8 @@ $$<p><br>
15161516 <description><p><a class="link" href="https://www.luogu.com.cn/problem/P9754" target="_blank" rel="noopener"
15171517 >题目传送门</a><br>
15181518<a class="link" href="https://www.luogu.com.cn/blog/best-blogs/solution-p9754" target="_blank" rel="noopener"
1519- >洛谷博客</a> <a class="link" href="https://blog.csdn.net/write_1m_lines/article/details/134758697 " target="_blank" rel="noopener"
1520- >CSDN </a></p>
1519+ >洛谷博客</a> <a class="link" href="https://www.cnblogs.com/stanleys/p/18403713/csps2023-t3 " target="_blank" rel="noopener"
1520+ >博客园 </a></p>
15211521<h3 id="基本思路">基本思路
15221522</h3><p>本题主要考查编码能力,所以直接给出基本思路:</p>
15231523<ul>
@@ -4147,7 +4147,7 @@ $0\le s_{i,j}\le 10^{16}$</p>
41474147</h3><p>对于两种算法,都需要预处理出每个结点的深度。<br>
41484148<strong>一个结点的深度定义为这个结点到树根的距离。</strong></p>
41494149<p>要预处理出所有结点的深度,很简单:<br>
4150- 运用<a class="link" href="https://blog.csdn.net/write_1m_lines/article/details/126263935 " target="_blank" rel="noopener"
4150+ 运用<a class="link" href="https://goodcoder666.github.io/p/algonotes-tree-dp/ " target="_blank" rel="noopener"
41514151 >树形dp</a>的方法,令 $h_u$ 表示结点 $u$ 的深度,逐层向下推进:</p>
41524152<div class="highlight"><div class="chroma">
41534153<table class="lntable"><tr><td class="lntd">
@@ -4871,7 +4871,7 @@ $$<p><br>
48714871<p>运行时间:$128\mathrm{ms}$<br>
48724872使用内存:$6.90\mathrm{MB}$</p>
48734873<h3 id="树状数组">树状数组
4874- </h3><p>关于树状数组的原理我已经在<a class="link" href="https://blog.csdn.net/write_1m_lines/article/details/126441412 " target="_blank" rel="noopener"
4874+ </h3><p>关于树状数组的原理我已经在<a class="link" href="https://goodcoder666.github.io/p/algonotes-fenwick-tree/ " target="_blank" rel="noopener"
48754875 >这篇文章</a>中讲过,这里不再多说了。下面我们考虑如何应用树状数组解决 RMQ 问题。</p>
48764876<h4 id="原算法">原算法
48774877</h4><p>树状数组可以用<code>lowbit</code>操作实现<code>prefixSum</code>(前缀和)以及<code>update</code>(更新)操作,时间复杂度均为$\mathcal O(N\log N)$。不仅是加法,<strong>对于任意满足结合律的运算这两种操作都有效。</strong></p>
@@ -6515,7 +6515,7 @@ $N$次操作后是否能到达终点$t$?<strong>注意:必须为最终
65156515</div><hr>
65166516<h2 id="扩展概念运算">扩展概念&amp;运算
65176517</h2><h3 id="lowbit">lowbit
6518- </h3><p><code>lowbit(x)</code>即为二进制下$x$的最低位,如<code>lowbit(10010) = 10</code>、<code>lowbit(1) = 1</code>。严格来说$0$没有<code>lowbit</code>,部分情况下可视为<code>lowbit(0) = 1</code>。利用<code>lowbit</code>函数可实现<a class="link" href="https://blog.csdn.net/write_1m_lines/article/details/126441412 " target="_blank" rel="noopener"
6518+ </h3><p><code>lowbit(x)</code>即为二进制下$x$的最低位,如<code>lowbit(10010) = 10</code>、<code>lowbit(1) = 1</code>。严格来说$0$没有<code>lowbit</code>,部分情况下可视为<code>lowbit(0) = 1</code>。利用<code>lowbit</code>函数可实现<a class="link" href="https://goodcoder666.github.io/p/algonotes-fenwick-tree/ " target="_blank" rel="noopener"
65196519 >树状数组</a>等数据结构。</p>
65206520<p><strong>lowbit 计算方式</strong></p>
65216521<ol>
@@ -6547,7 +6547,7 @@ $N$次操作后是否能到达终点$t$?<strong>注意:必须为最终
65476547时间复杂度$\mathcal O(1)$。相比(1)来说,代码更短,速度更快。</li>
65486548<li><code>x &amp; (x - 1)</code><br>
65496549<strong>注意:<code>x &amp; (x - 1)</code>不是<code>lowbit(x)</code>,而是<code>x - lowbit(x)</code>。</strong><br>
6550- 这种方法常用于<a class="link" href="https://blog.csdn.net/write_1m_lines/article/details/126441412 " target="_blank" rel="noopener"
6550+ 这种方法常用于<a class="link" href="https://goodcoder666.github.io/p/algonotes-fenwick-tree/ " target="_blank" rel="noopener"
65516551 >树状数组</a>中,可提升<code>x - lowbit(x)</code>的计算速度。</li>
65526552</ol>
65536553<h3 id="popcount">popcount
@@ -6883,8 +6883,8 @@ P.S. 这函数,不知是哪位神仙想出来的……</p>
68836883</div>
68846884</div><h5 id="习题atcoder-beginner-contest-258-g---trianglehttpsatcoderjpcontestsabc258tasksabc258_g">习题:<a class="link" href="https://atcoder.jp/contests/abc258/tasks/abc258_g" target="_blank" rel="noopener"
68856885 >AtCoder Beginner Contest 258 G - Triangle</a>
6886- </h5><p>题意和解法见<a class="link" href="https://blog.csdn.net/write_1m_lines/article/details/125582361#t15 " target="_blank" rel="noopener"
6887- >https://blog.csdn.net/write_1m_lines/article/details/125582361#t15 </a>。</p>
6886+ </h5><p>题意和解法见<a class="link" href="https://goodcoder666.github.io/p/abc258/#%E9%A2%98%E7%9B%AE%E5%A4%A7%E6%84%8F-2 " target="_blank" rel="noopener"
6887+ >我的题解 </a>。</p>
68886888<h3 id="深度优先搜索dfs的位运算优化">深度优先搜索(DFS)的位运算优化
68896889</h3><p>本算法其实还是<strong>二进制表示子集</strong>的一种优化,不过内容较多,所以单独放了出来。</p>
68906890<p>考虑经典的<strong>八皇后问题</strong>:</p>
@@ -8433,10 +8433,10 @@ $$<p><br>
84338433</span></span></code></pre></td></tr></table>
84348434</div>
84358435</div><h2 id="prim">Prim
8436- </h2><p>Prim算法于1930年由捷克数学家Vojtěch Jarník发现,在1957年又由美国计算机科学家Robert C. Prim独立发现。1959年,Edsger Wybe Dijkstra(没错,就是<a class="link" href="https://blog.csdn.net/write_1m_lines/article/details/126316941 " target="_blank" rel="noopener"
8436+ </h2><p>Prim算法于1930年由捷克数学家Vojtěch Jarník发现,在1957年又由美国计算机科学家Robert C. Prim独立发现。1959年,Edsger Wybe Dijkstra(没错,就是<a class="link" href="https://goodcoder666.github.io/p/algonotes-dijkstra/ " target="_blank" rel="noopener"
84378437 >Dijkstra</a>算法的发明者)再次发现了该算法。因此,在某些场合,Prim算法又被称为DJP算法、Jarník算法或Prim-Jarník算法。</p>
84388438<h3 id="prim-算法流程">Prim 算法流程
8439- </h3><p>Prim与<a class="link" href="https://blog.csdn.net/write_1m_lines/article/details/126316941 " target="_blank" rel="noopener"
8439+ </h3><p>Prim与<a class="link" href="https://goodcoder666.github.io/p/algonotes-dijkstra/ " target="_blank" rel="noopener"
84408440 >Dijkstra</a>很相似,将顶点分为$S$和$T$两个集合,具体流程如下:</p>
84418441<ol>
84428442<li>初始时,所有顶点全部在$S$中,$T$为空集。</li>
@@ -8701,7 +8701,7 @@ $$<p><br>
87018701 <guid>https://goodcoder666.github.io/p/algonotes-dijkstra/</guid>
87028702 <description><h2 id="前言">前言
87038703</h2><p>Dijkstra算法可在$\mathcal O(m\log m)$或$\mathcal O(m\log n)$的时间内求解无负权单源最短路问题。本文中,我们将详细介绍算法的原理、实现,以及常用的两种优化。</p>
8704- <p>另外,Dijkstra算法也不要乱用,比如说多源的最短路,用Dijkstra求解的复杂度只有$\mathcal O(nm\log m)$,但太麻烦,如果数据范围允许,直接用<a class="link" href="https://blog.csdn.net/write_1m_lines/article/details/126310381 " target="_blank" rel="noopener"
8704+ <p>另外,Dijkstra算法也不要乱用,比如说多源的最短路,用Dijkstra求解的复杂度只有$\mathcal O(nm\log m)$,但太麻烦,如果数据范围允许,直接用<a class="link" href="https://goodcoder666.github.io/p/algonotes-floyd/ " target="_blank" rel="noopener"
87058705 >Floyd</a>就能在$\mathcal O(n^3)$的时间内完成任务。</p>
87068706<p>废话不多说,下面来看Dijkstra算法的流程。</p>
87078707<h2 id="流程">流程
@@ -9127,7 +9127,7 @@ $$<p><br>
91279127
91289128 <guid>https://goodcoder666.github.io/p/algonotes-floyd/</guid>
91299129 <description><h2 id="前言">前言
9130- </h2><p>在图中,如果要求任意两点间的距离,则可以使用<code>Floyd</code>($\mathcal O(N^3)$;))和<a class="link" href="https://blog.csdn.net/write_1m_lines/article/details/126316941 " target="_blank" rel="noopener"
9130+ </h2><p>在图中,如果要求任意两点间的距离,则可以使用<code>Floyd</code>($\mathcal O(N^3)$;))和<a class="link" href="https://goodcoder666.github.io/p/algonotes-dijkstra/ " target="_blank" rel="noopener"
91319131 >Dijkstra</a>($\mathcal O(NM\log M)$:))。对于比较小的数据范围(一般为顶点数$N\le 150$),可以使用Floyd算法。本文将讲述Floyd算法的原理、实现和扩展应用。</p>
91329132<p>如果有哪里写得不好请各位dalao多多指教,谢谢!</p>
91339133<h2 id="原理">原理
@@ -33065,7 +33065,7 @@ $A_M~B_M$</p>
3306533065 <pubDate>Tue, 21 Apr 2020 18:32:00 +0800</pubDate>
3306633066
3306733067 <guid>https://goodcoder666.github.io/p/python-lambda-functions/</guid>
33068- <description><p><strong>温馨提示:如果读者没有学过<code>def</code>定义函数,请先看<a class="link" href="https://blog.csdn.net/write_1m_lines/article/details/105641275 " target="_blank" rel="noopener"
33068+ <description><p><strong>温馨提示:如果读者没有学过<code>def</code>定义函数,请先看<a class="link" href="https://goodcoder666.github.io/p/python-def-functions/ " target="_blank" rel="noopener"
3306933069 >这里</a></strong></p>
3307033070<h1 id="定义形式">定义形式
3307133071</h1><div class="highlight"><div class="chroma">
0 commit comments