Skip to content

Commit

Permalink
Site updated: 2024-10-23 21:03:13
Browse files Browse the repository at this point in the history
  • Loading branch information
Explorer-Dong committed Oct 23, 2024
1 parent 2269a59 commit 4ac3f69
Show file tree
Hide file tree
Showing 84 changed files with 1,006 additions and 1,165 deletions.
16 changes: 8 additions & 8 deletions Algorithm/a_template/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<meta property="og:description" content="板子 优雅的解法,少不了优雅的板子。目前仅编写 C++ 和 Python 语言对应的板子。前者用于备赛 Xcpc,后者用于备赛蓝桥杯。 基础算法 高精度 ▶C++ 1234567891011121314151617181920212223242526272829303132333435363">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2024-03-21T05:55:02.037Z">
<meta property="article:modified_time" content="2024-10-15T02:29:35.556Z">
<meta property="article:modified_time" content="2024-10-22T12:23:43.963Z">
<meta property="article:author" content="Mr_Dwj">
<meta property="article:tag" content="人工智能 机器学习 深度学习 算法 数据结构 计算机科学 编程">
<meta name="twitter:card" content="summary_large_image">
Expand Down Expand Up @@ -320,7 +320,7 @@ <h1 id="seo-header">a_template</h1>
<p id="updated-time" class="note note-info" style="">


本文最后更新于 2024年10月15日 上午
本文最后更新于 2024年10月22日 晚上


</p>
Expand Down Expand Up @@ -424,7 +424,7 @@ <h3 id="树状数组">树状数组</h3>
</div>
<div class="fold-collapse collapse" id="collapse-d7c7f3a4">
<div class="fold-content">
<figure class="highlight python"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><code class="hljs python"><span class="hljs-keyword">class</span> <span class="hljs-title class_">BinaryIndexedTree</span>:<br> <span class="hljs-keyword">def</span> <span class="hljs-title function_">__init__</span>(<span class="hljs-params">self, n: <span class="hljs-built_in">int</span></span>):<br> <span class="hljs-variable language_">self</span>.n = n<br> <span class="hljs-variable language_">self</span>.arr = [<span class="hljs-number">0</span>] * (n + <span class="hljs-number">1</span>)<br> <br> <span class="hljs-keyword">def</span> <span class="hljs-title function_">lowbit</span>(<span class="hljs-params">self, x: <span class="hljs-built_in">int</span></span>) -&gt; <span class="hljs-built_in">int</span>:<br> <span class="hljs-keyword">return</span> x &amp; (-x)<br> <br> <span class="hljs-keyword">def</span> <span class="hljs-title function_">add</span>(<span class="hljs-params">self, pos: <span class="hljs-built_in">int</span>, x: <span class="hljs-built_in">int</span></span>) -&gt; <span class="hljs-literal">None</span>:<br> <span class="hljs-keyword">while</span> pos &lt;= <span class="hljs-variable language_">self</span>.n:<br> <span class="hljs-variable language_">self</span>.arr[pos] += x<br> pos += <span class="hljs-variable language_">self</span>.lowbit(pos)<br> <br> <span class="hljs-keyword">def</span> <span class="hljs-title function_">sum</span>(<span class="hljs-params">self, pos: <span class="hljs-built_in">int</span></span>) -&gt; <span class="hljs-built_in">int</span>:<br> ret = <span class="hljs-number">0</span><br> <span class="hljs-keyword">while</span> pos:<br> ret += <span class="hljs-variable language_">self</span>.arr[pos]<br> pos -= <span class="hljs-variable language_">self</span>.lowbit(pos)<br> <span class="hljs-keyword">return</span> ret<br></code></pre></td></tr></tbody></table></figure>
<figure class="highlight python"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br></pre></td><td class="code"><pre><code class="hljs python"><span class="hljs-keyword">class</span> <span class="hljs-title class_">BinaryIndexedTree</span>:<br> <span class="hljs-keyword">def</span> <span class="hljs-title function_">__init__</span>(<span class="hljs-params">self, n: <span class="hljs-built_in">int</span></span>):<br> <span class="hljs-string">"""</span><br><span class="hljs-string"> 初始化序列 O(n)。下标从 1 开始,初始化维护序列区间为 [1,n]。</span><br><span class="hljs-string"> """</span><br> <span class="hljs-variable language_">self</span>.n = n<br> <span class="hljs-variable language_">self</span>.arr = [<span class="hljs-number">0</span>] * (n + <span class="hljs-number">1</span>)<br> <br> <span class="hljs-keyword">def</span> <span class="hljs-title function_">update</span>(<span class="hljs-params">self, pos: <span class="hljs-built_in">int</span>, x: <span class="hljs-built_in">int</span></span>) -&gt; <span class="hljs-literal">None</span>:<br> <span class="hljs-string">"""</span><br><span class="hljs-string"> 单点修改 O(log n)。在 pos 这个位置加上 x。</span><br><span class="hljs-string"> """</span><br> <span class="hljs-keyword">while</span> pos &lt;= <span class="hljs-variable language_">self</span>.n:<br> <span class="hljs-variable language_">self</span>.arr[pos] += x<br> pos += <span class="hljs-variable language_">self</span>._lowbit(pos)<br> <br> <span class="hljs-keyword">def</span> <span class="hljs-title function_">query_sum</span>(<span class="hljs-params">self, pos: <span class="hljs-built_in">int</span></span>) -&gt; <span class="hljs-built_in">int</span>:<br> <span class="hljs-string">"""</span><br><span class="hljs-string"> 区间求和 O(log n)。返回 [1,pos] 的区间和。</span><br><span class="hljs-string"> """</span><br> ret = <span class="hljs-number">0</span><br> <span class="hljs-keyword">while</span> pos:<br> ret += <span class="hljs-variable language_">self</span>.arr[pos]<br> pos -= <span class="hljs-variable language_">self</span>._lowbit(pos)<br> <span class="hljs-keyword">return</span> ret<br> <br> <span class="hljs-keyword">def</span> <span class="hljs-title function_">_lowbit</span>(<span class="hljs-params">self, x: <span class="hljs-built_in">int</span></span>) -&gt; <span class="hljs-built_in">int</span>:<br> <span class="hljs-keyword">return</span> x &amp; (-x)<br></code></pre></td></tr></tbody></table></figure>
</div>
</div>
</div>
Expand Down Expand Up @@ -581,7 +581,7 @@ <h2 id="计算几何">计算几何</h2>

<div class="license-meta-item license-meta-date">
<div>更新于</div>
<div>2024年10月15日</div>
<div>2024年10月22日</div>
</div>


Expand Down Expand Up @@ -612,18 +612,18 @@ <h2 id="计算几何">计算几何</h2>
<article class="post-prev col-6">


<a href="/Algorithm/number-theory/" title="number-theory">
<a href="/Algorithm/binary-search/" title="binary-search">
<i class="iconfont icon-arrowleft"></i>
<span class="hidden-mobile">number-theory</span>
<span class="hidden-mobile">binary-search</span>
<span class="visible-mobile">上一篇</span>
</a>

</article>
<article class="post-next col-6">


<a href="/README/" title="README">
<span class="hidden-mobile">README</span>
<a href="/Algorithm/data-structure/" title="data-structure">
<span class="hidden-mobile">data-structure</span>
<span class="visible-mobile">下一篇</span>
<i class="iconfont icon-arrowright"></i>
</a>
Expand Down
8 changes: 4 additions & 4 deletions Algorithm/binary-search/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -580,18 +580,18 @@ <h3 id="【二分查找】Bomb">【二分查找】Bomb</h3>
<article class="post-prev col-6">


<a href="/Algorithm/divide-and-conquer/" title="divide-and-conquer">
<a href="/README/" title="README">
<i class="iconfont icon-arrowleft"></i>
<span class="hidden-mobile">divide-and-conquer</span>
<span class="hidden-mobile">README</span>
<span class="visible-mobile">上一篇</span>
</a>

</article>
<article class="post-next col-6">


<a href="/Algorithm/dfs-and-similar/" title="dfs-and-similar">
<span class="hidden-mobile">dfs-and-similar</span>
<a href="/Algorithm/a_template/" title="a_template">
<span class="hidden-mobile">a_template</span>
<span class="visible-mobile">下一篇</span>
<i class="iconfont icon-arrowright"></i>
</a>
Expand Down
8 changes: 4 additions & 4 deletions Algorithm/data-structure/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -792,18 +792,18 @@ <h2 id="【线段树-二分】以组为单位订音乐会的门票-fire">【线
<article class="post-prev col-6">


<a href="/Algorithm/dfs-and-similar/" title="dfs-and-similar">
<a href="/Algorithm/a_template/" title="a_template">
<i class="iconfont icon-arrowleft"></i>
<span class="hidden-mobile">dfs-and-similar</span>
<span class="hidden-mobile">a_template</span>
<span class="visible-mobile">上一篇</span>
</a>

</article>
<article class="post-next col-6">


<a href="/Algorithm/dp/" title="dp">
<span class="hidden-mobile">dp</span>
<a href="/Algorithm/divide-and-conquer/" title="divide-and-conquer">
<span class="hidden-mobile">divide-and-conquer</span>
<span class="visible-mobile">下一篇</span>
<i class="iconfont icon-arrowright"></i>
</a>
Expand Down
10 changes: 2 additions & 8 deletions Algorithm/dfs-and-similar/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -857,22 +857,16 @@ <h3 id="【dfs】将石头分散到网格图的最少移动次数">【dfs】将
<article class="post-prev col-6">


<a href="/Algorithm/binary-search/" title="binary-search">
<a href="/Algorithm/dp/" title="dp">
<i class="iconfont icon-arrowleft"></i>
<span class="hidden-mobile">binary-search</span>
<span class="hidden-mobile">dp</span>
<span class="visible-mobile">上一篇</span>
</a>

</article>
<article class="post-next col-6">


<a href="/Algorithm/data-structure/" title="data-structure">
<span class="hidden-mobile">data-structure</span>
<span class="visible-mobile">下一篇</span>
<i class="iconfont icon-arrowright"></i>
</a>

</article>
</div>

Expand Down
8 changes: 4 additions & 4 deletions Algorithm/divide-and-conquer/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -425,18 +425,18 @@ <h3 id="【分治】随机排列">【分治】随机排列</h3>
<article class="post-prev col-6">


<a href="/README/" title="README">
<a href="/Algorithm/data-structure/" title="data-structure">
<i class="iconfont icon-arrowleft"></i>
<span class="hidden-mobile">README</span>
<span class="hidden-mobile">data-structure</span>
<span class="visible-mobile">上一篇</span>
</a>

</article>
<article class="post-next col-6">


<a href="/Algorithm/binary-search/" title="binary-search">
<span class="hidden-mobile">binary-search</span>
<a href="/Algorithm/dp/" title="dp">
<span class="hidden-mobile">dp</span>
<span class="visible-mobile">下一篇</span>
<i class="iconfont icon-arrowright"></i>
</a>
Expand Down
10 changes: 8 additions & 2 deletions Algorithm/dp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -979,16 +979,22 @@ <h3 id="【状压dp】Avoid-K-Palindrome-fire">【状压dp】Avoid K Palindrome
<article class="post-prev col-6">


<a href="/Algorithm/data-structure/" title="data-structure">
<a href="/Algorithm/divide-and-conquer/" title="divide-and-conquer">
<i class="iconfont icon-arrowleft"></i>
<span class="hidden-mobile">data-structure</span>
<span class="hidden-mobile">divide-and-conquer</span>
<span class="visible-mobile">上一篇</span>
</a>

</article>
<article class="post-next col-6">


<a href="/Algorithm/dfs-and-similar/" title="dfs-and-similar">
<span class="hidden-mobile">dfs-and-similar</span>
<span class="visible-mobile">下一篇</span>
<i class="iconfont icon-arrowright"></i>
</a>

</article>
</div>

Expand Down
8 changes: 4 additions & 4 deletions Algorithm/games/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -426,18 +426,18 @@ <h3 id="【博弈-贪心-交互】Salyg1n-and-the-MEX-Game">【博弈/贪心/交
<article class="post-prev col-6">


<a href="/Algorithm/z_logic/" title="z_logic">
<a href="/Algorithm/greedy/" title="greedy">
<i class="iconfont icon-arrowleft"></i>
<span class="hidden-mobile">z_logic</span>
<span class="hidden-mobile">greedy</span>
<span class="visible-mobile">上一篇</span>
</a>

</article>
<article class="post-next col-6">


<a href="/Algorithm/geometry/" title="geometry">
<span class="hidden-mobile">geometry</span>
<a href="/Algorithm/hashing/" title="hashing">
<span class="hidden-mobile">hashing</span>
<span class="visible-mobile">下一篇</span>
<i class="iconfont icon-arrowright"></i>
</a>
Expand Down
4 changes: 2 additions & 2 deletions Algorithm/geometry/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,9 @@ <h3 id="【凸包】奶牛过马路">【凸包】奶牛过马路</h3>
<article class="post-prev col-6">


<a href="/Algorithm/games/" title="games">
<a href="/BackEnd/back-end-guide/" title="back-end-guide">
<i class="iconfont icon-arrowleft"></i>
<span class="hidden-mobile">games</span>
<span class="hidden-mobile">back-end-guide</span>
<span class="visible-mobile">上一篇</span>
</a>

Expand Down
4 changes: 2 additions & 2 deletions Algorithm/graphs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -704,8 +704,8 @@ <h3 id="【LCA】树的直径">【LCA】树的直径</h3>
<article class="post-next col-6">


<a href="/Algorithm/hashing/" title="hashing">
<span class="hidden-mobile">hashing</span>
<a href="/Algorithm/greedy/" title="greedy">
<span class="hidden-mobile">greedy</span>
<span class="visible-mobile">下一篇</span>
<i class="iconfont icon-arrowright"></i>
</a>
Expand Down
8 changes: 4 additions & 4 deletions Algorithm/greedy/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -809,18 +809,18 @@ <h3 id="【按位贪心-分类讨论】">【按位贪心/分类讨论】</h3>
<article class="post-prev col-6">


<a href="/Algorithm/hashing/" title="hashing">
<a href="/Algorithm/graphs/" title="graphs">
<i class="iconfont icon-arrowleft"></i>
<span class="hidden-mobile">hashing</span>
<span class="hidden-mobile">graphs</span>
<span class="visible-mobile">上一篇</span>
</a>

</article>
<article class="post-next col-6">


<a href="/Algorithm/prefix-and-difference/" title="prefix-and-difference">
<span class="hidden-mobile">prefix-and-difference</span>
<a href="/Algorithm/games/" title="games">
<span class="hidden-mobile">games</span>
<span class="visible-mobile">下一篇</span>
<i class="iconfont icon-arrowright"></i>
</a>
Expand Down
Loading

0 comments on commit 4ac3f69

Please sign in to comment.