index.html 64 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
  6. <meta name="theme-color" content="#222">
  7. <meta name="generator" content="Hexo 4.2.0">
  8. <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  9. <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  10. <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  11. <link rel="mask-icon" href="/images/logo.svg" color="#222">
  12. <link rel="stylesheet" href="/css/main.css">
  13. <link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css">
  14. <link rel="stylesheet" href="/lib/pace/pace-theme-minimal.min.css">
  15. <script src="/lib/pace/pace.min.js"></script>
  16. <script id="hexo-configurations">
  17. var NexT = window.NexT || {};
  18. var CONFIG = {"hostname":"schtonn.github.io","root":"/","scheme":"Muse","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":true,"show_result":true,"style":"flat"},"back2top":{"enable":true,"sidebar":false,"scrollpercent":true},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":true,"pangu":false,"comments":{"style":"tabs","active":"valine","storage":true,"lazyload":false,"nav":null,"activeClass":"valine"},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}};
  19. </script>
  20. <meta name="description" content="The blog of a middle school OIer">
  21. <meta property="og:type" content="website">
  22. <meta property="og:title" content="Alex&#39;s Blog">
  23. <meta property="og:url" content="https://schtonn.github.io/index.html">
  24. <meta property="og:site_name" content="Alex&#39;s Blog">
  25. <meta property="og:description" content="The blog of a middle school OIer">
  26. <meta property="og:locale" content="en_US">
  27. <meta property="article:author" content="Alex">
  28. <meta name="twitter:card" content="summary">
  29. <link rel="canonical" href="https://schtonn.github.io/">
  30. <script id="page-configurations">
  31. // https://hexo.io/docs/variables.html
  32. CONFIG.page = {
  33. sidebar: "",
  34. isHome : true,
  35. isPost : false,
  36. lang : 'en'
  37. };
  38. </script>
  39. <title>Alex's Blog</title>
  40. <noscript>
  41. <style>
  42. .use-motion .brand,
  43. .use-motion .menu-item,
  44. .sidebar-inner,
  45. .use-motion .post-block,
  46. .use-motion .pagination,
  47. .use-motion .comments,
  48. .use-motion .post-header,
  49. .use-motion .post-body,
  50. .use-motion .collection-header { opacity: initial; }
  51. .use-motion .site-title,
  52. .use-motion .site-subtitle {
  53. opacity: initial;
  54. top: initial;
  55. }
  56. .use-motion .logo-line-before i { left: initial; }
  57. .use-motion .logo-line-after i { right: initial; }
  58. </style>
  59. </noscript>
  60. </head>
  61. <body itemscope itemtype="http://schema.org/WebPage">
  62. <div class="container use-motion">
  63. <div class="headband"></div>
  64. <header class="header" itemscope itemtype="http://schema.org/WPHeader">
  65. <div class="header-inner"><div class="site-brand-container">
  66. <div class="site-nav-toggle">
  67. <div class="toggle" aria-label="Toggle navigation bar">
  68. <span class="toggle-line toggle-line-first"></span>
  69. <span class="toggle-line toggle-line-middle"></span>
  70. <span class="toggle-line toggle-line-last"></span>
  71. </div>
  72. </div>
  73. <div class="site-meta">
  74. <a href="/" class="brand" rel="start">
  75. <span class="logo-line-before"><i></i></span>
  76. <h1 class="site-title">Alex's Blog</h1>
  77. <span class="logo-line-after"><i></i></span>
  78. </a>
  79. <p class="site-subtitle" itemprop="description">Middle school OIer</p>
  80. </div>
  81. <div class="site-nav-right">
  82. <div class="toggle popup-trigger">
  83. </div>
  84. </div>
  85. </div>
  86. <nav class="site-nav">
  87. <ul id="menu" class="menu">
  88. <li class="menu-item menu-item-home">
  89. <a href="/" rel="section"><i class="fa fa-fw fa-home"></i>Home</a>
  90. </li>
  91. <li class="menu-item menu-item-tags">
  92. <a href="/tags/" rel="section"><i class="fa fa-fw fa-tags"></i>Tags</a>
  93. </li>
  94. <li class="menu-item menu-item-archives">
  95. <a href="/archives/" rel="section"><i class="fa fa-fw fa-archive"></i>Archives</a>
  96. </li>
  97. <li class="menu-item menu-item-games">
  98. <a href="/games/" rel="section"><i class="fa fa-fw fa-gamepad"></i>Games</a>
  99. </li>
  100. <li class="menu-item menu-item-sans">
  101. <a href="/sans/" rel="section"><i class="fa fa-fw fa-heart"></i>sans</a>
  102. </li>
  103. </ul>
  104. </nav>
  105. </div>
  106. </header>
  107. <div class="back-to-top">
  108. <i class="fa fa-arrow-up"></i>
  109. <span>0%</span>
  110. </div>
  111. <div class="reading-progress-bar"></div>
  112. <main class="main">
  113. <div class="main-inner">
  114. <div class="content-wrap">
  115. <div class="content index posts-expand">
  116. <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
  117. <link itemprop="mainEntityOfPage" href="https://schtonn.github.io/posts/plan/">
  118. <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
  119. <meta itemprop="image" content="/images/avatar.gif">
  120. <meta itemprop="name" content="Alex">
  121. <meta itemprop="description" content="The blog of a middle school OIer">
  122. </span>
  123. <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
  124. <meta itemprop="name" content="Alex's Blog">
  125. </span>
  126. <header class="post-header">
  127. <h2 class="post-title" itemprop="name headline">
  128. <a href="/posts/plan/" class="post-title-link" itemprop="url">plan</a>
  129. </h2>
  130. <div class="post-meta">
  131. <span class="post-meta-item">
  132. <span class="post-meta-item-icon">
  133. <i class="fa fa-calendar-o"></i>
  134. </span>
  135. <span class="post-meta-item-text">Posted on</span>
  136. <time title="Created: 2020-Mar-01 22:36:07" itemprop="dateCreated datePublished" datetime="2020-03-01T22:36:07+08:00">2020-Mar-01</time>
  137. </span>
  138. <span class="post-meta-item">
  139. <span class="post-meta-item-icon">
  140. <i class="fa fa-calendar-check-o"></i>
  141. </span>
  142. <span class="post-meta-item-text">Edited on</span>
  143. <time title="Modified: 2020-Mar-29 15:59:42" itemprop="dateModified" datetime="2020-03-29T15:59:42+08:00">2020-Mar-29</time>
  144. </span>
  145. <span id="/posts/plan/" class="post-meta-item leancloud_visitors" data-flag-title="plan" title="Views">
  146. <span class="post-meta-item-icon">
  147. <i class="fa fa-eye"></i>
  148. </span>
  149. <span class="post-meta-item-text">Views: </span>
  150. <span class="leancloud-visitors-count"></span>
  151. </span>
  152. </div>
  153. </header>
  154. <div class="post-body" itemprop="articleBody">
  155. <p>This page is locked.</p>
  156. <!--noindex-->
  157. <div class="post-button">
  158. <a class="btn" href="/posts/plan/#more" rel="contents">
  159. Read more &raquo;
  160. </a>
  161. </div>
  162. <!--/noindex-->
  163. </div>
  164. <footer class="post-footer">
  165. <div class="post-eof"></div>
  166. </footer>
  167. </article>
  168. <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
  169. <link itemprop="mainEntityOfPage" href="https://schtonn.github.io/posts/matrix-pow/">
  170. <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
  171. <meta itemprop="image" content="/images/avatar.gif">
  172. <meta itemprop="name" content="Alex">
  173. <meta itemprop="description" content="The blog of a middle school OIer">
  174. </span>
  175. <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
  176. <meta itemprop="name" content="Alex's Blog">
  177. </span>
  178. <header class="post-header">
  179. <h2 class="post-title" itemprop="name headline">
  180. <a href="/posts/matrix-pow/" class="post-title-link" itemprop="url">矩阵快速幂运用</a>
  181. </h2>
  182. <div class="post-meta">
  183. <span class="post-meta-item">
  184. <span class="post-meta-item-icon">
  185. <i class="fa fa-calendar-o"></i>
  186. </span>
  187. <span class="post-meta-item-text">Posted on</span>
  188. <time title="Created: 2020-Mar-21 19:20:08" itemprop="dateCreated datePublished" datetime="2020-03-21T19:20:08+08:00">2020-Mar-21</time>
  189. </span>
  190. <span class="post-meta-item">
  191. <span class="post-meta-item-icon">
  192. <i class="fa fa-calendar-check-o"></i>
  193. </span>
  194. <span class="post-meta-item-text">Edited on</span>
  195. <time title="Modified: 2020-Mar-29 15:59:04" itemprop="dateModified" datetime="2020-03-29T15:59:04+08:00">2020-Mar-29</time>
  196. </span>
  197. <span id="/posts/matrix-pow/" class="post-meta-item leancloud_visitors" data-flag-title="矩阵快速幂运用" title="Views">
  198. <span class="post-meta-item-icon">
  199. <i class="fa fa-eye"></i>
  200. </span>
  201. <span class="post-meta-item-text">Views: </span>
  202. <span class="leancloud-visitors-count"></span>
  203. </span>
  204. </div>
  205. </header>
  206. <div class="post-body" itemprop="articleBody">
  207. <h3 id="引入"><a class="markdownIt-Anchor" href="#引入"></a> 引入</h3>
  208. <p>想要了解矩阵快速幂,就不得不提到矩阵的概念。矩阵就像一个二维数组,存储了一组数据,如:</p>
  209. <p class='katex-block'><span class="katex-display"><span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>M</mi><mo>=</mo><mrow><mo fence="true">[</mo><mtable rowspacing="0.15999999999999992em" columnspacing="1em"><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>1</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>2</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>3</mn></mstyle></mtd></mtr><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>4</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>5</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>6</mn></mstyle></mtd></mtr><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>7</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>8</mn></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mn>9</mn></mstyle></mtd></mtr></mtable><mo fence="true">]</mo></mrow></mrow><annotation encoding="application/x-tex">M=\left[
  210. \begin{matrix}
  211. 1&amp;2&amp;3\\
  212. 4&amp;5&amp;6\\
  213. 7&amp;8&amp;9\end{matrix}
  214. \right]</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.68333em;vertical-align:0em;"></span><span class="mord mathdefault" style="margin-right:0.10903em;">M</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span></span><span class="base"><span class="strut" style="height:3.60004em;vertical-align:-1.55002em;"></span><span class="minner"><span class="mopen"><span class="delimsizing mult"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:2.05002em;"><span style="top:-2.2500000000000004em;"><span class="pstrut" style="height:3.1550000000000002em;"></span><span class="delimsizinginner delim-size4"><span>⎣</span></span></span><span style="top:-4.05002em;"><span class="pstrut" style="height:3.1550000000000002em;"></span><span class="delimsizinginner delim-size4"><span>⎡</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:1.55002em;"><span></span></span></span></span></span></span><span class="mord"><span class="mtable"><span class="col-align-c"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:2.05em;"><span style="top:-4.21em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord">1</span></span></span><span style="top:-3.0099999999999993em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord">4</span></span></span><span style="top:-1.8099999999999994em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord">7</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:1.5500000000000007em;"><span></span></span></span></span></span><span class="arraycolsep" style="width:0.5em;"></span><span class="arraycolsep" style="width:0.5em;"></span><span class="col-align-c"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:2.05em;"><span style="top:-4.21em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord">2</span></span></span><span style="top:-3.0099999999999993em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord">5</span></span></span><span style="top:-1.8099999999999994em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord">8</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:1.5500000000000007em;"><span></span></span></span></span></span><span class="arraycolsep" style="width:0.5em;"></span><span class="arraycolsep" style="width:0.5em;"></span><span class="col-align-c"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:2.05em;"><span style="top:-4.21em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord">3</span></span></span><span style="top:-3.0099999999999993em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord">6</span></span></span><span style="top:-1.8099999999999994em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord">9</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:1.5500000000000007em;"><span></span></span></span></span></span></span></span><span class="mclose"><span class="delimsizing mult"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:2.05002em;"><span style="top:-2.2500000000000004em;"><span class="pstrut" style="height:3.1550000000000002em;"></span><span class="delimsizinginner delim-size4"><span>⎦</span></span></span><span style="top:-4.05002em;"><span class="pstrut" style="height:3.1550000000000002em;"></span><span class="delimsizinginner delim-size4"><span>⎤</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:1.55002em;"><span></span></span></span></span></span></span></span></span></span></span></span></p>
  215. <p>用 <span class="katex"><span class="katex-mathml"><math><semantics><mrow><msub><mi>M</mi><mrow><mi>i</mi><mo separator="true">,</mo><mi>j</mi></mrow></msub></mrow><annotation encoding="application/x-tex">M_{i,j}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.969438em;vertical-align:-0.286108em;"></span><span class="mord"><span class="mord mathdefault" style="margin-right:0.10903em;">M</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.311664em;"><span style="top:-2.5500000000000003em;margin-left:-0.10903em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathdefault mtight">i</span><span class="mpunct mtight">,</span><span class="mord mathdefault mtight" style="margin-right:0.05724em;">j</span></span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.286108em;"><span></span></span></span></span></span></span></span></span></span> 表示矩阵第 <span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>i</mi></mrow><annotation encoding="application/x-tex">i</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.65952em;vertical-align:0em;"></span><span class="mord mathdefault">i</span></span></span></span> 行第 <span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>j</mi></mrow><annotation encoding="application/x-tex">j</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.85396em;vertical-align:-0.19444em;"></span><span class="mord mathdefault" style="margin-right:0.05724em;">j</span></span></span></span> 列的数据,如 <span class="katex"><span class="katex-mathml"><math><semantics><mrow><msub><mi>M</mi><mrow><mn>2</mn><mo separator="true">,</mo><mn>3</mn></mrow></msub><mo>=</mo><mn>6</mn></mrow><annotation encoding="application/x-tex">M_{2,3}=6</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.969438em;vertical-align:-0.286108em;"></span><span class="mord"><span class="mord mathdefault" style="margin-right:0.10903em;">M</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.301108em;"><span style="top:-2.5500000000000003em;margin-left:-0.10903em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">2</span><span class="mpunct mtight">,</span><span class="mord mtight">3</span></span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.286108em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span></span><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">6</span></span></span></span>。</p>
  216. <!--noindex-->
  217. <div class="post-button">
  218. <a class="btn" href="/posts/matrix-pow/#more" rel="contents">
  219. Read more &raquo;
  220. </a>
  221. </div>
  222. <!--/noindex-->
  223. </div>
  224. <footer class="post-footer">
  225. <div class="post-eof"></div>
  226. </footer>
  227. </article>
  228. <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
  229. <link itemprop="mainEntityOfPage" href="https://schtonn.github.io/posts/computer/">
  230. <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
  231. <meta itemprop="image" content="/images/avatar.gif">
  232. <meta itemprop="name" content="Alex">
  233. <meta itemprop="description" content="The blog of a middle school OIer">
  234. </span>
  235. <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
  236. <meta itemprop="name" content="Alex's Blog">
  237. </span>
  238. <header class="post-header">
  239. <h2 class="post-title" itemprop="name headline">
  240. <a href="/posts/computer/" class="post-title-link" itemprop="url">How do computers work?</a>
  241. </h2>
  242. <div class="post-meta">
  243. <span class="post-meta-item">
  244. <span class="post-meta-item-icon">
  245. <i class="fa fa-calendar-o"></i>
  246. </span>
  247. <span class="post-meta-item-text">Posted on</span>
  248. <time title="Created: 2020-Mar-04 12:53:05" itemprop="dateCreated datePublished" datetime="2020-03-04T12:53:05+08:00">2020-Mar-04</time>
  249. </span>
  250. <span class="post-meta-item">
  251. <span class="post-meta-item-icon">
  252. <i class="fa fa-calendar-check-o"></i>
  253. </span>
  254. <span class="post-meta-item-text">Edited on</span>
  255. <time title="Modified: 2020-Mar-29 15:59:23" itemprop="dateModified" datetime="2020-03-29T15:59:23+08:00">2020-Mar-29</time>
  256. </span>
  257. <span id="/posts/computer/" class="post-meta-item leancloud_visitors" data-flag-title="How do computers work?" title="Views">
  258. <span class="post-meta-item-icon">
  259. <i class="fa fa-eye"></i>
  260. </span>
  261. <span class="post-meta-item-text">Views: </span>
  262. <span class="leancloud-visitors-count"></span>
  263. </span>
  264. </div>
  265. </header>
  266. <div class="post-body" itemprop="articleBody">
  267. <p>This page is locked</p>
  268. <!--noindex-->
  269. <div class="post-button">
  270. <a class="btn" href="/posts/computer/#more" rel="contents">
  271. Read more &raquo;
  272. </a>
  273. </div>
  274. <!--/noindex-->
  275. </div>
  276. <footer class="post-footer">
  277. <div class="post-eof"></div>
  278. </footer>
  279. </article>
  280. <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
  281. <link itemprop="mainEntityOfPage" href="https://schtonn.github.io/posts/segment-tree/">
  282. <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
  283. <meta itemprop="image" content="/images/avatar.gif">
  284. <meta itemprop="name" content="Alex">
  285. <meta itemprop="description" content="The blog of a middle school OIer">
  286. </span>
  287. <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
  288. <meta itemprop="name" content="Alex's Blog">
  289. </span>
  290. <header class="post-header">
  291. <h2 class="post-title" itemprop="name headline">
  292. <a href="/posts/segment-tree/" class="post-title-link" itemprop="url">线段树</a>
  293. </h2>
  294. <div class="post-meta">
  295. <span class="post-meta-item">
  296. <span class="post-meta-item-icon">
  297. <i class="fa fa-calendar-o"></i>
  298. </span>
  299. <span class="post-meta-item-text">Posted on</span>
  300. <time title="Created: 2020-Mar-02 11:37:36" itemprop="dateCreated datePublished" datetime="2020-03-02T11:37:36+08:00">2020-Mar-02</time>
  301. </span>
  302. <span class="post-meta-item">
  303. <span class="post-meta-item-icon">
  304. <i class="fa fa-calendar-check-o"></i>
  305. </span>
  306. <span class="post-meta-item-text">Edited on</span>
  307. <time title="Modified: 2020-Mar-29 15:59:45" itemprop="dateModified" datetime="2020-03-29T15:59:45+08:00">2020-Mar-29</time>
  308. </span>
  309. <span id="/posts/segment-tree/" class="post-meta-item leancloud_visitors" data-flag-title="线段树" title="Views">
  310. <span class="post-meta-item-icon">
  311. <i class="fa fa-eye"></i>
  312. </span>
  313. <span class="post-meta-item-text">Views: </span>
  314. <span class="leancloud-visitors-count"></span>
  315. </span>
  316. </div>
  317. </header>
  318. <div class="post-body" itemprop="articleBody">
  319. <h3 id="前置知识"><a class="markdownIt-Anchor" href="#前置知识"></a> 前置知识</h3>
  320. <p>数组,结构体,二叉树</p>
  321. <h3 id="引入"><a class="markdownIt-Anchor" href="#引入"></a> 引入</h3>
  322. <p>有时候我们会遇到一些大规模的区间查找和区间修改问题,比如让你维护一个 <span class="katex"><span class="katex-mathml"><math><semantics><mrow><mn>1</mn><msup><mn>0</mn><mn>5</mn></msup></mrow><annotation encoding="application/x-tex">10^5</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8141079999999999em;vertical-align:0em;"></span><span class="mord">1</span><span class="mord"><span class="mord">0</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141079999999999em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">5</span></span></span></span></span></span></span></span></span></span></span> 长度的数列,要求操作有区间求和、区间加(区间每个数加上一个值),让你在一秒内完成 <span class="katex"><span class="katex-mathml"><math><semantics><mrow><mn>1</mn><msup><mn>0</mn><mn>5</mn></msup></mrow><annotation encoding="application/x-tex">10^5</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8141079999999999em;vertical-align:0em;"></span><span class="mord">1</span><span class="mord"><span class="mord">0</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141079999999999em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">5</span></span></span></span></span></span></span></span></span></span></span> 次操作。<br />
  323. 暴力是肯定不行的,数据范围太大,操作太多,会超时。<br />
  324. 所以我们就有一种专门解决大范围区间修改查询的数据结构:线段树。</p>
  325. <!--noindex-->
  326. <div class="post-button">
  327. <a class="btn" href="/posts/segment-tree/#more" rel="contents">
  328. Read more &raquo;
  329. </a>
  330. </div>
  331. <!--/noindex-->
  332. </div>
  333. <footer class="post-footer">
  334. <div class="post-eof"></div>
  335. </footer>
  336. </article>
  337. <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
  338. <link itemprop="mainEntityOfPage" href="https://schtonn.github.io/posts/fibonacci/">
  339. <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
  340. <meta itemprop="image" content="/images/avatar.gif">
  341. <meta itemprop="name" content="Alex">
  342. <meta itemprop="description" content="The blog of a middle school OIer">
  343. </span>
  344. <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
  345. <meta itemprop="name" content="Alex's Blog">
  346. </span>
  347. <header class="post-header">
  348. <h2 class="post-title" itemprop="name headline">
  349. <a href="/posts/fibonacci/" class="post-title-link" itemprop="url">斐波那契数列-O(1)</a>
  350. </h2>
  351. <div class="post-meta">
  352. <span class="post-meta-item">
  353. <span class="post-meta-item-icon">
  354. <i class="fa fa-calendar-o"></i>
  355. </span>
  356. <span class="post-meta-item-text">Posted on</span>
  357. <time title="Created: 2020-Mar-02 11:35:44" itemprop="dateCreated datePublished" datetime="2020-03-02T11:35:44+08:00">2020-Mar-02</time>
  358. </span>
  359. <span class="post-meta-item">
  360. <span class="post-meta-item-icon">
  361. <i class="fa fa-calendar-check-o"></i>
  362. </span>
  363. <span class="post-meta-item-text">Edited on</span>
  364. <time title="Modified: 2020-Mar-29 22:23:24" itemprop="dateModified" datetime="2020-03-29T22:23:24+08:00">2020-Mar-29</time>
  365. </span>
  366. <span id="/posts/fibonacci/" class="post-meta-item leancloud_visitors" data-flag-title="斐波那契数列-O(1)" title="Views">
  367. <span class="post-meta-item-icon">
  368. <i class="fa fa-eye"></i>
  369. </span>
  370. <span class="post-meta-item-text">Views: </span>
  371. <span class="leancloud-visitors-count"></span>
  372. </span>
  373. </div>
  374. </header>
  375. <div class="post-body" itemprop="articleBody">
  376. <p>引自:《信息学奥赛之-数学一本通》<br />
  377. 揍是这样:</p>
  378. <p class='katex-block'><span class="katex-display"><span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi mathvariant="normal">F</mi><mo>⁡</mo><mo stretchy="false">(</mo><mi>n</mi><mo stretchy="false">)</mo><mo>=</mo><mfrac><msqrt><mn>5</mn></msqrt><mn>5</mn></mfrac><mo>⋅</mo><mrow><mo fence="true">[</mo><msup><mrow><mo fence="true">(</mo><mn>1</mn><mo>+</mo><msqrt><mn>5</mn></msqrt><mo fence="true">)</mo></mrow><mi>n</mi></msup><mo>−</mo><msup><mrow><mo fence="true">(</mo><mn>1</mn><mo>−</mo><msqrt><mn>5</mn></msqrt><mo fence="true">)</mo></mrow><mi>n</mi></msup><mo fence="true">]</mo></mrow></mrow><annotation encoding="application/x-tex">\operatorname{F}(n)=\dfrac{\sqrt{5}}{5}\cdot\left[\left(1+\sqrt{5}\right)^n-\left(1-\sqrt{5}\right)^n\right]
  379. </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mop"><span class="mord mathrm">F</span></span><span class="mopen">(</span><span class="mord mathdefault">n</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span></span><span class="base"><span class="strut" style="height:2.27022em;vertical-align:-0.686em;"></span><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.5842200000000002em;"><span style="top:-2.314em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord">5</span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.677em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord sqrt"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.90722em;"><span class="svg-align" style="top:-3em;"><span class="pstrut" style="height:3em;"></span><span class="mord" style="padding-left:0.833em;"><span class="mord">5</span></span></span><span style="top:-2.86722em;"><span class="pstrut" style="height:3em;"></span><span class="hide-tail" style="min-width:0.853em;height:1.08em;"><svg width='400em' height='1.08em' viewBox='0 0 400000 1080' preserveAspectRatio='xMinYMin slice'><path d='M95,702c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,
  380. -10,-9.5,-14c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54c44.2,-33.3,65.8,
  381. -50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10s173,378,173,378c0.7,0,
  382. 35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429c69,-144,104.5,-217.7,106.5,
  383. -221c5.3,-9.3,12,-14,20,-14H400000v40H845.2724s-225.272,467,-225.272,467
  384. s-235,486,-235,486c-2.7,4.7,-9,7,-19,7c-6,0,-10,-1,-12,-3s-194,-422,-194,-422
  385. s-65,47,-65,47z M834 80H400000v40H845z'/></svg></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.13278em;"><span></span></span></span></span></span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.686em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">⋅</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span></span><span class="base"><span class="strut" style="height:1.854312em;vertical-align:-0.65002em;"></span><span class="minner"><span class="mopen delimcenter" style="top:0em;"><span class="delimsizing size2">[</span></span><span class="minner"><span class="minner"><span class="mopen delimcenter" style="top:0em;"><span class="delimsizing size2">(</span></span><span class="mord">1</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mord sqrt"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.956095em;"><span class="svg-align" style="top:-3em;"><span class="pstrut" style="height:3em;"></span><span class="mord" style="padding-left:0.833em;"><span class="mord">5</span></span></span><span style="top:-2.916095em;"><span class="pstrut" style="height:3em;"></span><span class="hide-tail" style="min-width:0.853em;height:1.08em;"><svg width='400em' height='1.08em' viewBox='0 0 400000 1080' preserveAspectRatio='xMinYMin slice'><path d='M95,702c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,
  386. -10,-9.5,-14c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54c44.2,-33.3,65.8,
  387. -50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10s173,378,173,378c0.7,0,
  388. 35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429c69,-144,104.5,-217.7,106.5,
  389. -221c5.3,-9.3,12,-14,20,-14H400000v40H845.2724s-225.272,467,-225.272,467
  390. s-235,486,-235,486c-2.7,4.7,-9,7,-19,7c-6,0,-10,-1,-12,-3s-194,-422,-194,-422
  391. s-65,47,-65,47z M834 80H400000v40H845z'/></svg></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.08390500000000001em;"><span></span></span></span></span></span><span class="mclose delimcenter" style="top:0em;"><span class="delimsizing size2">)</span></span></span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:1.204292em;"><span style="top:-3.6029em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight">n</span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="minner"><span class="minner"><span class="mopen delimcenter" style="top:0em;"><span class="delimsizing size2">(</span></span><span class="mord">1</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mord sqrt"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.956095em;"><span class="svg-align" style="top:-3em;"><span class="pstrut" style="height:3em;"></span><span class="mord" style="padding-left:0.833em;"><span class="mord">5</span></span></span><span style="top:-2.916095em;"><span class="pstrut" style="height:3em;"></span><span class="hide-tail" style="min-width:0.853em;height:1.08em;"><svg width='400em' height='1.08em' viewBox='0 0 400000 1080' preserveAspectRatio='xMinYMin slice'><path d='M95,702c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,
  392. -10,-9.5,-14c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54c44.2,-33.3,65.8,
  393. -50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10s173,378,173,378c0.7,0,
  394. 35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429c69,-144,104.5,-217.7,106.5,
  395. -221c5.3,-9.3,12,-14,20,-14H400000v40H845.2724s-225.272,467,-225.272,467
  396. s-235,486,-235,486c-2.7,4.7,-9,7,-19,7c-6,0,-10,-1,-12,-3s-194,-422,-194,-422
  397. s-65,47,-65,47z M834 80H400000v40H845z'/></svg></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.08390500000000001em;"><span></span></span></span></span></span><span class="mclose delimcenter" style="top:0em;"><span class="delimsizing size2">)</span></span></span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:1.204292em;"><span style="top:-3.6029em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight">n</span></span></span></span></span></span></span></span><span class="mclose delimcenter" style="top:0em;"><span class="delimsizing size2">]</span></span></span></span></span></span></span></p>
  398. <p>代码揍这么简单:</p>
  399. <figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">int</span> <span class="title">fibo</span><span class="params">(<span class="keyword">int</span> n)</span></span>&#123;</span><br><span class="line"> <span class="keyword">return</span> (<span class="built_in">sqrt</span>(<span class="number">5</span>)/<span class="number">5</span>)*(<span class="built_in">pow</span>((<span class="number">1</span>+<span class="built_in">sqrt</span>(<span class="number">5</span>))/<span class="number">2</span>,n)-<span class="built_in">pow</span>((<span class="number">1</span>-<span class="built_in">sqrt</span>(<span class="number">5</span>))/<span class="number">2</span>,n));</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
  400. <p>要是再加个快速幂就更棒了(够快了,懒得写)</p>
  401. </div>
  402. <footer class="post-footer">
  403. <div class="post-eof"></div>
  404. </footer>
  405. </article>
  406. <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
  407. <link itemprop="mainEntityOfPage" href="https://schtonn.github.io/posts/dinic/">
  408. <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
  409. <meta itemprop="image" content="/images/avatar.gif">
  410. <meta itemprop="name" content="Alex">
  411. <meta itemprop="description" content="The blog of a middle school OIer">
  412. </span>
  413. <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
  414. <meta itemprop="name" content="Alex's Blog">
  415. </span>
  416. <header class="post-header">
  417. <h2 class="post-title" itemprop="name headline">
  418. <a href="/posts/dinic/" class="post-title-link" itemprop="url">网络最大流-Dinic</a>
  419. </h2>
  420. <div class="post-meta">
  421. <span class="post-meta-item">
  422. <span class="post-meta-item-icon">
  423. <i class="fa fa-calendar-o"></i>
  424. </span>
  425. <span class="post-meta-item-text">Posted on</span>
  426. <time title="Created: 2020-Mar-02 11:31:22" itemprop="dateCreated datePublished" datetime="2020-03-02T11:31:22+08:00">2020-Mar-02</time>
  427. </span>
  428. <span class="post-meta-item">
  429. <span class="post-meta-item-icon">
  430. <i class="fa fa-calendar-check-o"></i>
  431. </span>
  432. <span class="post-meta-item-text">Edited on</span>
  433. <time title="Modified: 2020-Mar-29 15:59:26" itemprop="dateModified" datetime="2020-03-29T15:59:26+08:00">2020-Mar-29</time>
  434. </span>
  435. <span id="/posts/dinic/" class="post-meta-item leancloud_visitors" data-flag-title="网络最大流-Dinic" title="Views">
  436. <span class="post-meta-item-icon">
  437. <i class="fa fa-eye"></i>
  438. </span>
  439. <span class="post-meta-item-text">Views: </span>
  440. <span class="leancloud-visitors-count"></span>
  441. </span>
  442. </div>
  443. </header>
  444. <div class="post-body" itemprop="articleBody">
  445. <h3 id="前置知识"><a class="markdownIt-Anchor" href="#前置知识"></a> 前置知识</h3>
  446. <p>存图方式(<a href="http://baidu.physton.com/?q=%E9%82%BB%E6%8E%A5%E8%A1%A8" target="_blank" rel="noopener" title="简单">邻接表</a>,<a href="http://baidu.physton.com/?q=%E9%82%BB%E6%8E%A5%E7%9F%A9%E9%98%B5" target="_blank" rel="noopener" title="都太简单了">邻接矩阵</a>),图的遍历(<a href="http://baidu.physton.com/?q=dfs" target="_blank" rel="noopener" title="简单">dfs</a>,<a href="http://baidu.physton.com/?q=bfs" target="_blank" rel="noopener" title="简单">bfs</a>)</p>
  447. <h3 id="引入"><a class="markdownIt-Anchor" href="#引入"></a> 引入</h3>
  448. <p>我们举个例子吧:<br />
  449. 有一个毒瘤水管工,他会造水管,有一天他造了一个水管网络,就像一个图。其中有一个点只有出边,就是起点,还有一个点只有入边,是终点。<br />
  450. 点之间有一些管子,这些管子都有单位时间内的容量,现在毒瘤水管工想知道,他的管子在<strong>单位时间内</strong>在起点终点之间最多能流多少水。</p>
  451. <!--noindex-->
  452. <div class="post-button">
  453. <a class="btn" href="/posts/dinic/#more" rel="contents">
  454. Read more &raquo;
  455. </a>
  456. </div>
  457. <!--/noindex-->
  458. </div>
  459. <footer class="post-footer">
  460. <div class="post-eof"></div>
  461. </footer>
  462. </article>
  463. <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
  464. <link itemprop="mainEntityOfPage" href="https://schtonn.github.io/posts/min-span-tree/">
  465. <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
  466. <meta itemprop="image" content="/images/avatar.gif">
  467. <meta itemprop="name" content="Alex">
  468. <meta itemprop="description" content="The blog of a middle school OIer">
  469. </span>
  470. <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
  471. <meta itemprop="name" content="Alex's Blog">
  472. </span>
  473. <header class="post-header">
  474. <h2 class="post-title" itemprop="name headline">
  475. <a href="/posts/min-span-tree/" class="post-title-link" itemprop="url">最小生成树</a>
  476. </h2>
  477. <div class="post-meta">
  478. <span class="post-meta-item">
  479. <span class="post-meta-item-icon">
  480. <i class="fa fa-calendar-o"></i>
  481. </span>
  482. <span class="post-meta-item-text">Posted on</span>
  483. <time title="Created: 2020-Mar-01 22:45:44" itemprop="dateCreated datePublished" datetime="2020-03-01T22:45:44+08:00">2020-Mar-01</time>
  484. </span>
  485. <span class="post-meta-item">
  486. <span class="post-meta-item-icon">
  487. <i class="fa fa-calendar-check-o"></i>
  488. </span>
  489. <span class="post-meta-item-text">Edited on</span>
  490. <time title="Modified: 2020-Mar-29 15:59:39" itemprop="dateModified" datetime="2020-03-29T15:59:39+08:00">2020-Mar-29</time>
  491. </span>
  492. <span id="/posts/min-span-tree/" class="post-meta-item leancloud_visitors" data-flag-title="最小生成树" title="Views">
  493. <span class="post-meta-item-icon">
  494. <i class="fa fa-eye"></i>
  495. </span>
  496. <span class="post-meta-item-text">Views: </span>
  497. <span class="leancloud-visitors-count"></span>
  498. </span>
  499. </div>
  500. </header>
  501. <div class="post-body" itemprop="articleBody">
  502. <h3 id="前置知识"><a class="markdownIt-Anchor" href="#前置知识"></a> 前置知识</h3>
  503. <p>存图方式(<a href="http://baidu.physton.com/?q=%E9%82%BB%E6%8E%A5%E8%A1%A8" target="_blank" rel="noopener" title="简单">邻接表</a>,<a href="http://baidu.physton.com/?q=%E9%82%BB%E6%8E%A5%E7%9F%A9%E9%98%B5" target="_blank" rel="noopener" title="都太简单了,没有一个打得过的">邻接矩阵</a>),<a href="https://schtonn.github.io/2020/03/01/union-find">并查集</a>。<br />
  504. 不会的快进入链接学习吧!</p>
  505. <h3 id="引入"><a class="markdownIt-Anchor" href="#引入"></a> 引入</h3>
  506. <p>生成树,就是从一个图中选中<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>n</mi><mo>−</mo><mn>1</mn></mrow><annotation encoding="application/x-tex">n-1</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.66666em;vertical-align:-0.08333em;"></span><span class="mord mathdefault">n</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span></span><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">1</span></span></span></span>条边,使得这些边构成一棵树,并包含图中的所有节点。<br />
  507. 最小生成树,就是找到一种生成树,使得这个生成树的边权和最小。</p>
  508. <!--noindex-->
  509. <div class="post-button">
  510. <a class="btn" href="/posts/min-span-tree/#more" rel="contents">
  511. Read more &raquo;
  512. </a>
  513. </div>
  514. <!--/noindex-->
  515. </div>
  516. <footer class="post-footer">
  517. <div class="post-eof"></div>
  518. </footer>
  519. </article>
  520. <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
  521. <link itemprop="mainEntityOfPage" href="https://schtonn.github.io/posts/union-find/">
  522. <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
  523. <meta itemprop="image" content="/images/avatar.gif">
  524. <meta itemprop="name" content="Alex">
  525. <meta itemprop="description" content="The blog of a middle school OIer">
  526. </span>
  527. <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
  528. <meta itemprop="name" content="Alex's Blog">
  529. </span>
  530. <header class="post-header">
  531. <h2 class="post-title" itemprop="name headline">
  532. <a href="/posts/union-find/" class="post-title-link" itemprop="url">并查集</a>
  533. </h2>
  534. <div class="post-meta">
  535. <span class="post-meta-item">
  536. <span class="post-meta-item-icon">
  537. <i class="fa fa-calendar-o"></i>
  538. </span>
  539. <span class="post-meta-item-text">Posted on</span>
  540. <time title="Created: 2020-Mar-01 22:44:33" itemprop="dateCreated datePublished" datetime="2020-03-01T22:44:33+08:00">2020-Mar-01</time>
  541. </span>
  542. <span class="post-meta-item">
  543. <span class="post-meta-item-icon">
  544. <i class="fa fa-calendar-check-o"></i>
  545. </span>
  546. <span class="post-meta-item-text">Edited on</span>
  547. <time title="Modified: 2020-Mar-29 15:59:58" itemprop="dateModified" datetime="2020-03-29T15:59:58+08:00">2020-Mar-29</time>
  548. </span>
  549. <span id="/posts/union-find/" class="post-meta-item leancloud_visitors" data-flag-title="并查集" title="Views">
  550. <span class="post-meta-item-icon">
  551. <i class="fa fa-eye"></i>
  552. </span>
  553. <span class="post-meta-item-text">Views: </span>
  554. <span class="leancloud-visitors-count"></span>
  555. </span>
  556. </div>
  557. </header>
  558. <div class="post-body" itemprop="articleBody">
  559. <h3 id="前置知识"><a class="markdownIt-Anchor" href="#前置知识"></a> 前置知识</h3>
  560. <p>哈哈,简单到爆,没有。</p>
  561. <h3 id="引入"><a class="markdownIt-Anchor" href="#引入"></a> 引入</h3>
  562. <p>并查集是一种快到爆炸的集合算法,可以进行两项基本操作:合并两个集合(并)、查询两个参数是否在一个集合内(查)。这也是它名字的由来。</p>
  563. <!--noindex-->
  564. <div class="post-button">
  565. <a class="btn" href="/posts/union-find/#more" rel="contents">
  566. Read more &raquo;
  567. </a>
  568. </div>
  569. <!--/noindex-->
  570. </div>
  571. <footer class="post-footer">
  572. <div class="post-eof"></div>
  573. </footer>
  574. </article>
  575. <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
  576. <link itemprop="mainEntityOfPage" href="https://schtonn.github.io/posts/tree-link/">
  577. <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
  578. <meta itemprop="image" content="/images/avatar.gif">
  579. <meta itemprop="name" content="Alex">
  580. <meta itemprop="description" content="The blog of a middle school OIer">
  581. </span>
  582. <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
  583. <meta itemprop="name" content="Alex's Blog">
  584. </span>
  585. <header class="post-header">
  586. <h2 class="post-title" itemprop="name headline">
  587. <a href="/posts/tree-link/" class="post-title-link" itemprop="url">树链剖分</a>
  588. </h2>
  589. <div class="post-meta">
  590. <span class="post-meta-item">
  591. <span class="post-meta-item-icon">
  592. <i class="fa fa-calendar-o"></i>
  593. </span>
  594. <span class="post-meta-item-text">Posted on</span>
  595. <time title="Created: 2020-Mar-01 22:41:02" itemprop="dateCreated datePublished" datetime="2020-03-01T22:41:02+08:00">2020-Mar-01</time>
  596. </span>
  597. <span class="post-meta-item">
  598. <span class="post-meta-item-icon">
  599. <i class="fa fa-calendar-check-o"></i>
  600. </span>
  601. <span class="post-meta-item-text">Edited on</span>
  602. <time title="Modified: 2020-Mar-29 15:59:54" itemprop="dateModified" datetime="2020-03-29T15:59:54+08:00">2020-Mar-29</time>
  603. </span>
  604. <span id="/posts/tree-link/" class="post-meta-item leancloud_visitors" data-flag-title="树链剖分" title="Views">
  605. <span class="post-meta-item-icon">
  606. <i class="fa fa-eye"></i>
  607. </span>
  608. <span class="post-meta-item-text">Views: </span>
  609. <span class="leancloud-visitors-count"></span>
  610. </span>
  611. </div>
  612. </header>
  613. <div class="post-body" itemprop="articleBody">
  614. <h3 id="前置知识"><a class="markdownIt-Anchor" href="#前置知识"></a> 前置知识</h3>
  615. <p>必备:存图方式(<a href="http://baidu.physton.com/?q=%E9%82%BB%E6%8E%A5%E8%A1%A8" target="_blank" rel="noopener" title="简单">邻接表</a>,<a href="http://baidu.physton.com/?q=%E9%82%BB%E6%8E%A5%E7%9F%A9%E9%98%B5" target="_blank" rel="noopener" title="都太简单了,没有一个打得过的">邻接矩阵</a>),<a href="http://baidu.physton.com/?q=dfs%E5%BA%8F" target="_blank" rel="noopener">dfs序</a>。<br />
  616. 维护:<a href="http://baidu.physton.com/?q=%E7%BA%BF%E6%AE%B5%E6%A0%91" target="_blank" rel="noopener">线段树</a>、<a href="http://baidu.physton.com/?q=%E6%A0%91%E7%8A%B6%E6%95%B0%E7%BB%84" target="_blank" rel="noopener">树状数组</a>、<a href="http://baidu.physton.com/?q=BST" target="_blank" rel="noopener">BST</a>。<br />
  617. 不会的快进入链接学习吧!</p>
  618. <h3 id="引入"><a class="markdownIt-Anchor" href="#引入"></a> 引入</h3>
  619. <p>树链剖分,简单来说就是把树分割成链,然后维护每一条链。一般的维护算法有线段树,树状数组和BST。复杂度为<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>O</mi><mo stretchy="false">(</mo><mi>l</mi><mi>o</mi><mi>g</mi><mi>n</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">O(log n)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathdefault" style="margin-right:0.02778em;">O</span><span class="mopen">(</span><span class="mord mathdefault" style="margin-right:0.01968em;">l</span><span class="mord mathdefault">o</span><span class="mord mathdefault" style="margin-right:0.03588em;">g</span><span class="mord mathdefault">n</span><span class="mclose">)</span></span></span></span>。</p>
  620. <!--noindex-->
  621. <div class="post-button">
  622. <a class="btn" href="/posts/tree-link/#more" rel="contents">
  623. Read more &raquo;
  624. </a>
  625. </div>
  626. <!--/noindex-->
  627. </div>
  628. <footer class="post-footer">
  629. <div class="post-eof"></div>
  630. </footer>
  631. </article>
  632. <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
  633. <link itemprop="mainEntityOfPage" href="https://schtonn.github.io/posts/test/">
  634. <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
  635. <meta itemprop="image" content="/images/avatar.gif">
  636. <meta itemprop="name" content="Alex">
  637. <meta itemprop="description" content="The blog of a middle school OIer">
  638. </span>
  639. <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
  640. <meta itemprop="name" content="Alex's Blog">
  641. </span>
  642. <header class="post-header">
  643. <h2 class="post-title" itemprop="name headline">
  644. <a href="/posts/test/" class="post-title-link" itemprop="url">test</a>
  645. </h2>
  646. <div class="post-meta">
  647. <span class="post-meta-item">
  648. <span class="post-meta-item-icon">
  649. <i class="fa fa-calendar-o"></i>
  650. </span>
  651. <span class="post-meta-item-text">Posted on</span>
  652. <time title="Created: 2020-Mar-01 11:06:43" itemprop="dateCreated datePublished" datetime="2020-03-01T11:06:43+08:00">2020-Mar-01</time>
  653. </span>
  654. <span class="post-meta-item">
  655. <span class="post-meta-item-icon">
  656. <i class="fa fa-calendar-check-o"></i>
  657. </span>
  658. <span class="post-meta-item-text">Edited on</span>
  659. <time title="Modified: 2020-Mar-29 15:59:49" itemprop="dateModified" datetime="2020-03-29T15:59:49+08:00">2020-Mar-29</time>
  660. </span>
  661. <span id="/posts/test/" class="post-meta-item leancloud_visitors" data-flag-title="test" title="Views">
  662. <span class="post-meta-item-icon">
  663. <i class="fa fa-eye"></i>
  664. </span>
  665. <span class="post-meta-item-text">Views: </span>
  666. <span class="leancloud-visitors-count"></span>
  667. </span>
  668. </div>
  669. </header>
  670. <div class="post-body" itemprop="articleBody">
  671. <p><span class="katex"><span class="katex-mathml"><math><semantics><mrow><mtext mathvariant="monospace">Is</mtext><mtext> </mtext><mtext mathvariant="monospace">KaTeX</mtext><mtext> </mtext><mtext mathvariant="monospace">working?-IT</mtext><mtext> </mtext><mtext mathvariant="monospace">WORKED!NICE!</mtext></mrow><annotation encoding="application/x-tex">\texttt{Is KaTeX working?-IT WORKED!NICE!}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.83333em;vertical-align:-0.22222em;"></span><span class="mord text"><span class="mord texttt">Is KaTeX working?-IT WORKED!NICE!</span></span></span></span></span></p>
  672. <p class='katex-block'><span class="katex-display"><span class="katex"><span class="katex-mathml"><math><semantics><mrow><msup><mi>a</mi><mi>b</mi></msup></mrow><annotation encoding="application/x-tex">a^b
  673. </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8991079999999999em;vertical-align:0em;"></span><span class="mord"><span class="mord mathdefault">a</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8991079999999999em;"><span style="top:-3.113em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight">b</span></span></span></span></span></span></span></span></span></span></span></span></p>
  674. <p class='katex-block'><span class="katex-display"><span class="katex"><span class="katex-mathml"><math><semantics><mrow><mo fence="true">(</mo><mfrac><mi>a</mi><mi>b</mi></mfrac><mo fence="true">)</mo></mrow><annotation encoding="application/x-tex">\left(\dfrac{a}{b}\right)
  675. </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.8359999999999999em;vertical-align:-0.686em;"></span><span class="minner"><span class="mopen delimcenter" style="top:0em;"><span class="delimsizing size2">(</span></span><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.10756em;"><span style="top:-2.314em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord mathdefault">b</span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.677em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord mathdefault">a</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.686em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span><span class="mclose delimcenter" style="top:0em;"><span class="delimsizing size2">)</span></span></span></span></span></span></span></p>
  676. </div>
  677. <footer class="post-footer">
  678. <div class="post-eof"></div>
  679. </footer>
  680. </article>
  681. </div>
  682. <script>
  683. window.addEventListener('tabs:register', () => {
  684. let { activeClass } = CONFIG.comments;
  685. if (CONFIG.comments.storage) {
  686. activeClass = localStorage.getItem('comments_active') || activeClass;
  687. }
  688. if (activeClass) {
  689. let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
  690. if (activeTab) {
  691. activeTab.click();
  692. }
  693. }
  694. });
  695. if (CONFIG.comments.storage) {
  696. window.addEventListener('tabs:click', event => {
  697. if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
  698. let commentClass = event.target.classList[1];
  699. localStorage.setItem('comments_active', commentClass);
  700. });
  701. }
  702. </script>
  703. </div>
  704. <div class="toggle sidebar-toggle">
  705. <span class="toggle-line toggle-line-first"></span>
  706. <span class="toggle-line toggle-line-middle"></span>
  707. <span class="toggle-line toggle-line-last"></span>
  708. </div>
  709. <aside class="sidebar">
  710. <div class="sidebar-inner">
  711. <ul class="sidebar-nav motion-element">
  712. <li class="sidebar-nav-toc">
  713. Table of Contents
  714. </li>
  715. <li class="sidebar-nav-overview">
  716. Overview
  717. </li>
  718. </ul>
  719. <!--noindex-->
  720. <div class="post-toc-wrap sidebar-panel">
  721. </div>
  722. <!--/noindex-->
  723. <div class="site-overview-wrap sidebar-panel">
  724. <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  725. <p class="site-author-name" itemprop="name">Alex</p>
  726. <div class="site-description" itemprop="description">The blog of a middle school OIer</div>
  727. </div>
  728. <div class="site-state-wrap motion-element">
  729. <nav class="site-state">
  730. <div class="site-state-item site-state-posts">
  731. <a href="/archives">
  732. <span class="site-state-item-count">10</span>
  733. <span class="site-state-item-name">posts</span>
  734. </a>
  735. </div>
  736. <div class="site-state-item site-state-tags">
  737. <a href="/tags/">
  738. <span class="site-state-item-count">4</span>
  739. <span class="site-state-item-name">tags</span></a>
  740. </div>
  741. </nav>
  742. </div>
  743. <div class="links-of-author motion-element">
  744. <span class="links-of-author-item">
  745. <a href="https://github.com/schtonn" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;schtonn" rel="noopener" target="_blank"><i class="fa fa-fw fa-github"></i>GitHub</a>
  746. </span>
  747. <span class="links-of-author-item">
  748. <a href="mailto:m18519511495@163.com" title="E-Mail → mailto:m18519511495@163.com" rel="noopener" target="_blank"><i class="fa fa-fw fa-envelope"></i>E-Mail</a>
  749. </span>
  750. </div>
  751. <div class="links-of-blogroll motion-element">
  752. <div class="links-of-blogroll-title">
  753. <i class="fa fa-fw fa-link"></i>
  754. Links
  755. </div>
  756. <ul class="links-of-blogroll-list">
  757. <li class="links-of-blogroll-item">
  758. <a href="https://yonghong.github.io/" title="https:&#x2F;&#x2F;yonghong.github.io" rel="noopener" target="_blank">Yonghong</a>
  759. </li>
  760. <li class="links-of-blogroll-item">
  761. <a href="https://source.unsplash.com/random/1600x900" title="https:&#x2F;&#x2F;source.unsplash.com&#x2F;random&#x2F;1600x900" rel="noopener" target="_blank">Background</a>
  762. </li>
  763. </ul>
  764. </div>
  765. </div>
  766. <div id="treefrog" style="text-align: center;margin-top: 18px;">
  767. <object type="application/x-shockwave-flash" style="outline:none;" data="/flash/treefrog.swf?up_bodyColor=444444&up_pattern=0&up_flyColor=777777&up_tongueColor=555555&up_patternColor=000000&up_releaseFly=0&up_frogName=Froggie&up_backgroundImage=http://&up_bellySize=.5&up_footColor=444444&up_eyeColor=444444&up_backgroundColor=222222&" width="300" height="600"><param name="movie" value="http://cdn.abowman.com/widgets/treefrog/treefrog.swf?up_bodyColor=444444&up_pattern=0&up_flyColor=777777&up_tongueColor=555555&up_patternColor=000000&up_releaseFly=0&up_frogName=Froggie&up_backgroundImage=http://&up_bellySize=.5&up_footColor=444444&up_eyeColor=444444&up_backgroundColor=222222&"></param><param name="AllowScriptAccess" value="always"></param><param name="wmode" value="opaque"></param><param name="scale" value="noscale"/><param name="salign" value="tl"/></object>
  768. </div>
  769. </div>
  770. </aside>
  771. <div id="sidebar-dimmer"></div>
  772. </div>
  773. </main>
  774. <footer class="footer">
  775. <div class="footer-inner">
  776. <div class="copyright">
  777. &copy;
  778. <span itemprop="copyrightYear">2020</span>
  779. <span class="with-love">
  780. <i class="fa fa-user"></i>
  781. </span>
  782. <span class="author" itemprop="copyrightHolder">Alex Xiang</span>
  783. </div>
  784. </div>
  785. </footer>
  786. </div>
  787. <script src="/lib/anime.min.js"></script>
  788. <script src="//cdn.jsdelivr.net/npm/lozad@1/dist/lozad.min.js"></script>
  789. <script src="/lib/velocity/velocity.min.js"></script>
  790. <script src="/lib/velocity/velocity.ui.min.js"></script>
  791. <script src="/js/utils.js"></script>
  792. <script src="/js/motion.js"></script>
  793. <script src="/js/schemes/muse.js"></script>
  794. <script src="/js/next-boot.js"></script>
  795. <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/katex@0/dist/katex.min.css">
  796. <script>
  797. NexT.utils.loadComments(document.querySelector('#valine-comments'), () => {
  798. NexT.utils.getScript('//unpkg.com/valine/dist/Valine.min.js', () => {
  799. var GUEST = ['nick', 'mail', 'link'];
  800. var guest = 'nick,mail,link';
  801. guest = guest.split(',').filter(item => {
  802. return GUEST.includes(item);
  803. });
  804. new Valine({
  805. el : '#valine-comments',
  806. verify : true,
  807. notify : true,
  808. appId : 'BmologYYnRqCv0SLHDeDdA17-gzGzoHsz',
  809. appKey : 'w9mVebFMdCmY6Nh9vfcBGaGt',
  810. placeholder: "Say something.",
  811. avatar : 'mm',
  812. meta : guest,
  813. pageSize : '10' || 10,
  814. visitor : true,
  815. lang : 'en' || 'zh-cn',
  816. path : location.pathname,
  817. recordIP : true,
  818. serverURLs : ''
  819. });
  820. }, window.Valine);
  821. });
  822. </script>
  823. </body>
  824. </html>