<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>CHAOS·IO</title><description>算法题解、算法笔记与题目归档。</description><link>https://io.chaos-ljc.top/</link><language>zh-CN</language><atom:link href="https://io.chaos-ljc.top/rss.xml" rel="self" type="application/rss+xml"/><lastBuildDate>Tue, 27 Oct 2026 06:39:56 GMT</lastBuildDate><item><title>Markdown 示例：本站支持的写法都在这里</title><link>https://io.chaos-ljc.top/posts/markdown-example/</link><guid isPermaLink="true">https://io.chaos-ljc.top/posts/markdown-example/</guid><description>一篇示例文章，覆盖标题、列表、表格、代码、公式、图表、提示块、脚注、Wiki 链接等全部写法，可当作写作手册使用。</description><pubDate>Mon, 26 Oct 2026 02:00:00 GMT</pubDate><content:encoded>&lt;blockquote&gt;
&lt;p&gt;这是一篇&lt;strong&gt;示例文章&lt;/strong&gt;（Markdown Example）：把本站支持的所有写法集中展示一遍。
写新文章时可以对照本页，也可以直接复制这里的片段。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&quot;写在前面&quot;&gt;写在前面&lt;/h2&gt;
&lt;p&gt;文章的元信息写在文件顶部的 frontmatter 里，常用字段如下：&lt;/p&gt;
&lt;div class=&quot;expressive-code&quot;&gt;&lt;figure class=&quot;frame has-title&quot;&gt;&lt;figcaption class=&quot;header&quot;&gt;&lt;span class=&quot;title&quot;&gt;frontmatter 示例&lt;/span&gt;&lt;/figcaption&gt;&lt;pre data-language=&quot;yaml&quot;&gt;&lt;code&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt;---&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;title&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--0:#68640C;--1:#B8BB26&quot;&gt;文章标题&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6A5F54;--0fs:italic;--1:#9D9082;--1fs:italic&quot;&gt;# 必填&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;description&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--0:#68640C;--1:#B8BB26&quot;&gt;一句话摘要&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6A5F54;--0fs:italic;--1:#9D9082;--1fs:italic&quot;&gt;# 必填，用于列表、RSS 与 meta&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;pubDatetime&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;2026-10-26T10:00:00+08:00&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6A5F54;--0fs:italic;--1:#9D9082;--1fs:italic&quot;&gt;# 必填&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;category&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#68640C;--1:#B8BB26&quot;&gt;算法&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6A5F54;--0fs:italic;--1:#9D9082;--1fs:italic&quot;&gt;# 文章类型：题解 / 题目 / 算法&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;series&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#68640C;--1:#B8BB26&quot;&gt;动态规划入门&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6A5F54;--0fs:italic;--1:#9D9082;--1fs:italic&quot;&gt;# 有先后顺序的一组文章&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;tags&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--0:#68640C;--1:#B8BB26&quot;&gt;动态规划&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#68640C;--1:#B8BB26&quot;&gt;洛谷&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6A5F54;--0fs:italic;--1:#9D9082;--1fs:italic&quot;&gt;# 来源、题号、所用算法……&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;measure&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#68640C;--1:#B8BB26&quot;&gt;cjk&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6A5F54;--0fs:italic;--1:#9D9082;--1fs:italic&quot;&gt;# 栏宽口径，可省略（按正文自动判断）&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;toc&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6A5F54;--0fs:italic;--1:#9D9082;--1fs:italic&quot;&gt;# 右侧目录，默认开启&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;math&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6A5F54;--0fs:italic;--1:#9D9082;--1fs:italic&quot;&gt;# 加载公式样式，纯文字文章可设 false&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;draft&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6A5F54;--0fs:italic;--1:#9D9082;--1fs:italic&quot;&gt;# true 时不参与构建&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt;---&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;h2 id=&quot;标题&quot;&gt;标题&lt;/h2&gt;
&lt;p&gt;支持二到五级标题，二级标题会自动出现在右侧目录里。&lt;/p&gt;
&lt;h3 id=&quot;三级标题&quot;&gt;三级标题&lt;/h3&gt;
&lt;h4 id=&quot;四级标题&quot;&gt;四级标题&lt;/h4&gt;
&lt;h5 id=&quot;五级标题&quot;&gt;五级标题&lt;/h5&gt;
&lt;h2 id=&quot;段落与行内元素&quot;&gt;段落与行内元素&lt;/h2&gt;
&lt;p&gt;普通段落里可以混排各种行内元素：&lt;strong&gt;粗体&lt;/strong&gt;、&lt;em&gt;斜体&lt;/em&gt;、&lt;del&gt;删除线&lt;/del&gt;、&lt;code&gt;行内代码&lt;/code&gt;、&lt;mark&gt;高亮&lt;/mark&gt;、&lt;kbd&gt;Ctrl&lt;/kbd&gt; + &lt;kbd&gt;C&lt;/kbd&gt;、H&lt;sub&gt;2&lt;/sub&gt;O 与 x&lt;sup&gt;2&lt;/sup&gt;、&lt;abbr title=&quot;HyperText Markup Language&quot;&gt;HTML&lt;/abbr&gt;。&lt;/p&gt;
&lt;p&gt;链接分两种：&lt;a href=&quot;https://astro.build&quot; class=&quot;link-external&quot; rel=&quot;noopener&quot;&gt;站外链接&lt;/a&gt;（自动带 ↗ 角标）与&lt;a href=&quot;https://io.chaos-ljc.top/posts/&quot; class=&quot;link-internal&quot;&gt;站内链接&lt;/a&gt;（保持普通下划线）。引用一篇文章可以直接写 &lt;a href=&quot;https://io.chaos-ljc.top/posts/p1002-guo-he-zu/&quot; class=&quot;link-internal&quot;&gt;「洛谷 P1002」过河卒&lt;/a&gt;，也可以自定义文字 &lt;a href=&quot;https://io.chaos-ljc.top/posts/p1002-guo-he-zu/&quot; class=&quot;link-internal&quot;&gt;「洛谷 P1002」过河卒&lt;/a&gt;，或者跳到本文的某个小节 &lt;a href=&quot;https://io.chaos-ljc.top/posts/markdown-example/#%E4%B8%AD%E6%96%87%E6%8E%92%E7%89%88&quot;&gt;中文排版&lt;/a&gt;。&lt;/p&gt;
&lt;h3 id=&quot;中文排版&quot;&gt;中文排版&lt;/h3&gt;
&lt;p&gt;中英混排时会自动在中英文之间留出间距：Astro 7 用 TypeScript 写了 3 个工具函数，Kaggle 数据集有 1.2 万条记录，复杂度是 &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;O&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;n&lt;/mi&gt;&lt;mi&gt;log&lt;/mi&gt;&lt;mo&gt;⁡&lt;/mo&gt;&lt;mi&gt;n&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;O(n \log n)&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;，常数是 1e-9。&lt;/p&gt;
&lt;p&gt;引号用「」或”“都好看；破折号——比如这样——两端会自动对齐。全角标点（，。！？）后面的空隙也会被压掉，不会在行尾留下一个空格。&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;行首的「」会被收紧，段落之间的间距是 0.9em，段首缩进默认关闭（可以用 &lt;code&gt;typography.paragraphIndent&lt;/code&gt; 打开）。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&quot;列表&quot;&gt;列表&lt;/h2&gt;
&lt;p&gt;无序列表：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;第一项&lt;/li&gt;
&lt;li&gt;第二项
&lt;ul&gt;
&lt;li&gt;嵌套的第二层&lt;/li&gt;
&lt;li&gt;嵌套的第二层&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;第三项&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;有序列表：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;读题&lt;/li&gt;
&lt;li&gt;想思路&lt;/li&gt;
&lt;li&gt;写代码&lt;/li&gt;
&lt;li&gt;交题&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;任务列表：&lt;/p&gt;
&lt;ul class=&quot;contains-task-list&quot;&gt;
&lt;li class=&quot;task-list-item&quot;&gt;&lt;input type=&quot;checkbox&quot; checked=&quot;&quot; disabled=&quot;&quot; aria-label=&quot;Done: 写完题解&quot;&gt; 写完题解&lt;/li&gt;
&lt;li class=&quot;task-list-item&quot;&gt;&lt;input type=&quot;checkbox&quot; checked=&quot;&quot; disabled=&quot;&quot; aria-label=&quot;Done: 补上复杂度&quot;&gt; 补上复杂度&lt;/li&gt;
&lt;li class=&quot;task-list-item&quot;&gt;&lt;input type=&quot;checkbox&quot; disabled=&quot;&quot; aria-label=&quot;To do: 等评测结果&quot;&gt; 等评测结果&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;引用&quot;&gt;引用&lt;/h2&gt;
&lt;blockquote&gt;
&lt;p&gt;引用块常用来放题面信息或结论。&lt;/p&gt;
&lt;p&gt;它可以包含多个段落。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;嵌套引用：&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;外层引用&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;内层引用&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/blockquote&gt;
&lt;h2 id=&quot;提示块&quot;&gt;提示块&lt;/h2&gt;
&lt;p&gt;五种类型都可以用，两种写法等价：&lt;/p&gt;
&lt;aside class=&quot;callout&quot; data-callout=&quot;note&quot;&gt;&lt;p class=&quot;callout-title&quot;&gt;注意&lt;/p&gt;&lt;div class=&quot;callout-body&quot;&gt;&lt;p&gt;补充说明，不影响主线。&lt;/p&gt;&lt;/div&gt;&lt;/aside&gt;
&lt;aside class=&quot;callout&quot; data-callout=&quot;tip&quot;&gt;&lt;p class=&quot;callout-title&quot;&gt;提示&lt;/p&gt;&lt;div class=&quot;callout-body&quot;&gt;&lt;p&gt;一点小技巧。&lt;/p&gt;&lt;/div&gt;&lt;/aside&gt;
&lt;aside class=&quot;callout&quot; data-callout=&quot;important&quot;&gt;&lt;p class=&quot;callout-title&quot;&gt;重要&lt;/p&gt;&lt;div class=&quot;callout-body&quot;&gt;&lt;p&gt;容易被忽略但很关键的地方。&lt;/p&gt;&lt;/div&gt;&lt;/aside&gt;
&lt;aside class=&quot;callout&quot; data-callout=&quot;warning&quot;&gt;&lt;p class=&quot;callout-title&quot;&gt;警告&lt;/p&gt;&lt;div class=&quot;callout-body&quot;&gt;&lt;p&gt;容易踩的坑。&lt;/p&gt;&lt;/div&gt;&lt;/aside&gt;
&lt;aside class=&quot;callout&quot; data-callout=&quot;caution&quot;&gt;&lt;p class=&quot;callout-title&quot;&gt;危险&lt;/p&gt;&lt;div class=&quot;callout-body&quot;&gt;&lt;p&gt;危险操作。&lt;/p&gt;&lt;/div&gt;&lt;/aside&gt;
&lt;p&gt;也可以用指令写法并自定义标题：&lt;/p&gt;
&lt;aside class=&quot;callout&quot; data-callout=&quot;tip&quot;&gt;&lt;p class=&quot;callout-title&quot;&gt;自定义标题&lt;/p&gt;&lt;div class=&quot;callout-body&quot;&gt;&lt;p&gt;&lt;code&gt;:::tip[标题]&lt;/code&gt; 与 &lt;code&gt;&amp;gt; [!TIP]&lt;/code&gt; 等价，中文站点下默认标题是「提示」。&lt;/p&gt;&lt;/div&gt;&lt;/aside&gt;
&lt;h2 id=&quot;表格&quot;&gt;表格&lt;/h2&gt;
&lt;p&gt;GFM 表格，支持三种对齐方式：&lt;/p&gt;
&lt;table tabindex=&quot;0&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th style=&quot;text-align: left&quot;&gt;左对齐&lt;/th&gt;
&lt;th style=&quot;text-align: center&quot;&gt;居中&lt;/th&gt;
&lt;th style=&quot;text-align: right&quot;&gt;右对齐&lt;/th&gt;
&lt;th&gt;说明&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;O(n)&lt;/code&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: center&quot;&gt;&lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;O&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;n&lt;/mi&gt;&lt;mi&gt;log&lt;/mi&gt;&lt;mo&gt;⁡&lt;/mo&gt;&lt;mi&gt;n&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;O(n \log n)&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td style=&quot;text-align: right&quot;&gt;128 MB&lt;/td&gt;
&lt;td&gt;时间复杂度 / 空间复杂度&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;text-align: left&quot;&gt;洛谷&lt;/td&gt;
&lt;td style=&quot;text-align: center&quot;&gt;普及-&lt;/td&gt;
&lt;td style=&quot;text-align: right&quot;&gt;1s&lt;/td&gt;
&lt;td&gt;来源、难度、限制&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;表格在窄屏可以横向滚动。&lt;/p&gt;
&lt;h2 id=&quot;代码&quot;&gt;代码&lt;/h2&gt;
&lt;p&gt;行内代码用反引号：&lt;code&gt;std::vector&amp;lt;int&amp;gt;&lt;/code&gt;。&lt;/p&gt;
&lt;p&gt;代码块会自动显示语言标签，并且支持这些 meta：&lt;/p&gt;
&lt;div class=&quot;expressive-code&quot;&gt;&lt;figure class=&quot;frame&quot;&gt;&lt;figcaption class=&quot;header&quot;&gt;&lt;/figcaption&gt;&lt;pre data-language=&quot;markdown&quot;&gt;&lt;code&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;```&lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;cpp title=&quot;main.cpp&quot; {3-5} ins={7} del={8} showLineNumbers&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#6A5F54;--0fs:italic;--1:#9D9082;--1fs:italic&quot;&gt;// 你的代码&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;```&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;table tabindex=&quot;0&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;meta&lt;/th&gt;
&lt;th&gt;作用&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;title=&quot;main.cpp&quot;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;顶栏显示文件名&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;{3-5}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;高亮第 3–5 行&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ins={7}&lt;/code&gt; / &lt;code&gt;del={8}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;标记新增 / 删除的行&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;&quot;关键字&quot;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;高亮某个词&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;collapse={1-4}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;折叠区段（可展开）&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;showLineNumbers&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;显示行号&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;带文件名与高亮行：&lt;/p&gt;
&lt;div class=&quot;expressive-code&quot;&gt;&lt;figure class=&quot;frame has-title&quot;&gt;&lt;figcaption class=&quot;header&quot;&gt;&lt;span class=&quot;title&quot;&gt;main.cpp&lt;/span&gt;&lt;/figcaption&gt;&lt;pre data-language=&quot;cpp&quot;&gt;&lt;code&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;include&lt;/span&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;--0:#68640C;--1:#B8BB26&quot;&gt;bits/stdc++.h&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#9D0006;--1:#FB5D4A&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt;namespace&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;std&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;main&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;ios&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;sync_with_stdio&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line highlight mark&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;cin&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;tie&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;nullptr&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line highlight mark&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#6A5F54;--0fs:italic;--1:#9D9082;--1fs:italic&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#6A5F54;--0fs:italic;--1:#9D9082;--1fs:italic&quot;&gt;// 读入 n&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line highlight mark&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;cin&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#9D0006;--1:#FB5D4A&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;标记新增与删除的行：&lt;/p&gt;
&lt;div class=&quot;expressive-code&quot;&gt;&lt;figure class=&quot;frame has-title&quot;&gt;&lt;figcaption class=&quot;header&quot;&gt;&lt;span class=&quot;title&quot;&gt;diff.cpp&lt;/span&gt;&lt;/figcaption&gt;&lt;pre data-language=&quot;cpp&quot;&gt;&lt;code&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;main&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;--0:#6A5F54;--0fs:italic;--1:#9D9082;--1fs:italic&quot;&gt;   // 新增&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line highlight ins&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#6A5F54;--0fs:italic;--1:#9D9082;--1fs:italic&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#6A5F54;--0fs:italic;--1:#9D9082;--1fs:italic&quot;&gt;// int m = 1;   // 删除&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line highlight del&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;cin&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;折叠区段（点击标题展开）：&lt;/p&gt;
&lt;div class=&quot;expressive-code&quot;&gt;&lt;figure class=&quot;frame has-title&quot;&gt;&lt;figcaption class=&quot;header&quot;&gt;&lt;span class=&quot;title&quot;&gt;collapse.cpp&lt;/span&gt;&lt;/figcaption&gt;&lt;pre data-language=&quot;cpp&quot;&gt;&lt;code&gt;&lt;details class=&quot;ec-section github&quot;&gt;&lt;summary&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;expand&quot;&gt;&lt;/span&gt;&lt;span class=&quot;collapse&quot;&gt;&lt;/span&gt;&lt;span class=&quot;text&quot;&gt;7 行已折叠&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/summary&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;include&lt;/span&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;--0:#68640C;--1:#B8BB26&quot;&gt;bits/stdc++.h&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#9D0006;--1:#FB5D4A&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt;namespace&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;std&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;main&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#6A5F54;--0fs:italic;--1:#9D9082;--1fs:italic&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#6A5F54;--0fs:italic;--1:#9D9082;--1fs:italic&quot;&gt;// 这部分默认折叠&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#9D0006;--1:#FB5D4A&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/details&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;终端样式（&lt;code&gt;bash&lt;/code&gt; / &lt;code&gt;sh&lt;/code&gt; 自动使用终端外框）：&lt;/p&gt;
&lt;div class=&quot;expressive-code&quot;&gt;&lt;figure class=&quot;frame is-terminal has-title&quot;&gt;&lt;figcaption class=&quot;header&quot;&gt;&lt;span class=&quot;title&quot;&gt;build.sh&lt;/span&gt;&lt;/figcaption&gt;&lt;pre data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;pnpm&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#68640C;--1:#B8BB26&quot;&gt;install&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;pnpm&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#68640C;--1:#B8BB26&quot;&gt;build&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;其他语言也一样：&lt;/p&gt;
&lt;div class=&quot;expressive-code&quot;&gt;&lt;figure class=&quot;frame has-title&quot;&gt;&lt;figcaption class=&quot;header&quot;&gt;&lt;span class=&quot;title&quot;&gt;solve.py&lt;/span&gt;&lt;/figcaption&gt;&lt;pre data-language=&quot;python&quot;&gt;&lt;code&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#9D0006;--1:#FB5D4A&quot;&gt;def&lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt; solve&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;():&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt;n &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt;input&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;())&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt;print&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#504945;--1:#D5C4A1&quot;&gt;n &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;--0:#504945;--1:#D5C4A1&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;div class=&quot;expressive-code&quot;&gt;&lt;figure class=&quot;frame has-title&quot;&gt;&lt;figcaption class=&quot;header&quot;&gt;&lt;span class=&quot;title&quot;&gt;solve.js&lt;/span&gt;&lt;/figcaption&gt;&lt;pre data-language=&quot;javascript&quot;&gt;&lt;code&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt;const&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;solve&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;h2 id=&quot;公式&quot;&gt;公式&lt;/h2&gt;
&lt;p&gt;行内公式用 &lt;code&gt;$…$&lt;/code&gt;：&lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;msup&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mrow&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;mi&gt;π&lt;/mi&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;e^{i\pi} + 1 = 0&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;，复杂度写成 &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;O&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;n&lt;/mi&gt;&lt;mi&gt;log&lt;/mi&gt;&lt;mo&gt;⁡&lt;/mo&gt;&lt;mi&gt;n&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;O(n \log n)&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;。&lt;/p&gt;
&lt;p&gt;独立成行的公式用 &lt;code&gt;$$…$$&lt;/code&gt;：&lt;/p&gt;
&lt;div class=&quot;math-display&quot; tabindex=&quot;0&quot;&gt;&lt;span class=&quot;katex-display&quot;&gt;&lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;f&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;mo separator=&quot;true&quot;&gt;,&lt;/mo&gt;&lt;mi&gt;j&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;munder&gt;&lt;mrow&gt;&lt;mi&gt;min&lt;/mi&gt;&lt;mo&gt;⁡&lt;/mo&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mi&gt;k&lt;/mi&gt;&lt;mo&gt;&amp;lt;&lt;/mo&gt;&lt;mi&gt;j&lt;/mi&gt;&lt;/mrow&gt;&lt;/munder&gt;&lt;mo fence=&quot;true&quot; stretchy=&quot;true&quot; minsize=&quot;1.2em&quot; maxsize=&quot;1.2em&quot;&gt;{&lt;/mo&gt;&lt;mi&gt;f&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mo separator=&quot;true&quot;&gt;,&lt;/mo&gt;&lt;mi&gt;k&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;w&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;k&lt;/mi&gt;&lt;mo separator=&quot;true&quot;&gt;,&lt;/mo&gt;&lt;mi&gt;j&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;mo fence=&quot;true&quot; stretchy=&quot;true&quot; minsize=&quot;1.2em&quot; maxsize=&quot;1.2em&quot;&gt;}&lt;/mo&gt;&lt;mo separator=&quot;true&quot;&gt;,&lt;/mo&gt;&lt;mspace width=&quot;2em&quot;&gt;&lt;/mspace&gt;&lt;mi&gt;f&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;mo separator=&quot;true&quot;&gt;,&lt;/mo&gt;&lt;mi&gt;j&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;f(i, j) = \min_{k &amp;lt; j} \bigl\{ f(i-1, k) + w(k, j) \bigr\},\qquad f(0, j) = 0&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;公式在构建期渲染，不加载任何 JavaScript。&lt;/p&gt;
&lt;h2 id=&quot;图表&quot;&gt;图表&lt;/h2&gt;
&lt;p&gt;Mermaid 图直接写在围栏里：&lt;/p&gt;
&lt;figure class=&quot;diagram&quot; data-diagram=&quot;mermaid&quot; data-dv-labels=&quot;{&amp;quot;open&amp;quot;:&amp;quot;在查看器中打开 {{label}}&amp;quot;,&amp;quot;zoom&amp;quot;:&amp;quot;缩放（或双击）&amp;quot;,&amp;quot;zoomIn&amp;quot;:&amp;quot;放大&amp;quot;,&amp;quot;zoomOut&amp;quot;:&amp;quot;缩小&amp;quot;,&amp;quot;select&amp;quot;:&amp;quot;选择文本&amp;quot;,&amp;quot;selecting&amp;quot;:&amp;quot;正在选择文本&amp;quot;,&amp;quot;close&amp;quot;:&amp;quot;关闭查看器&amp;quot;,&amp;quot;hint&amp;quot;:&amp;quot;滚轮或双指缩放 · 拖动平移 · 0 适应窗口 · 1 原始大小 · Esc 关闭&amp;quot;,&amp;quot;viewerLabel&amp;quot;:&amp;quot;图表查看器&amp;quot;,&amp;quot;controlsLabel&amp;quot;:&amp;quot;图表控制&amp;quot;}&quot;&gt;
&lt;div class=&quot;diagram-canvas&quot; role=&quot;img&quot; aria-label=&quot;构建流程&quot;&gt;
&lt;div class=&quot;diagram-svg diagram-light&quot;&gt;&lt;svg id=&quot;mermaid-58bcb292d1debfbf-light-0&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot; xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot; class=&quot;flowchart&quot; style=&quot;max-width: 713.640625px;&quot; viewBox=&quot;0 0 713.640625 150&quot; role=&quot;graphics-document document&quot; aria-roledescription=&quot;flowchart-v2&quot;&gt;&lt;style&gt;#mermaid-58bcb292d1debfbf-light-0{font-family:&quot;JetBrains Mono&quot;,&quot;Noto Sans SC Variable&quot;,ui-monospace,monospace;font-size:14px;fill:#2b2620;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-58bcb292d1debfbf-light-0 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-58bcb292d1debfbf-light-0 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-58bcb292d1debfbf-light-0 .error-icon{fill:#f7f3ea;}#mermaid-58bcb292d1debfbf-light-0 .error-text{fill:#2b2620;stroke:#2b2620;}#mermaid-58bcb292d1debfbf-light-0 .edge-thickness-normal{stroke-width:1px;}#mermaid-58bcb292d1debfbf-light-0 .edge-thickness-thick{stroke-width:3.5px;}#mermaid-58bcb292d1debfbf-light-0 .edge-pattern-solid{stroke-dasharray:0;}#mermaid-58bcb292d1debfbf-light-0 .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-58bcb292d1debfbf-light-0 .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-58bcb292d1debfbf-light-0 .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-58bcb292d1debfbf-light-0 .marker{fill:#6b6153;stroke:#6b6153;}#mermaid-58bcb292d1debfbf-light-0 .marker.cross{stroke:#6b6153;}#mermaid-58bcb292d1debfbf-light-0 svg{font-family:&quot;JetBrains Mono&quot;,&quot;Noto Sans SC Variable&quot;,ui-monospace,monospace;font-size:14px;}#mermaid-58bcb292d1debfbf-light-0 p{margin:0;}#mermaid-58bcb292d1debfbf-light-0 .label{font-family:&quot;JetBrains Mono&quot;,&quot;Noto Sans SC Variable&quot;,ui-monospace,monospace;color:#2b2620;}#mermaid-58bcb292d1debfbf-light-0 .cluster-label text{fill:#2b2620;}#mermaid-58bcb292d1debfbf-light-0 .cluster-label span{color:#2b2620;}#mermaid-58bcb292d1debfbf-light-0 .cluster-label span p{background-color:transparent;}#mermaid-58bcb292d1debfbf-light-0 .label text,#mermaid-58bcb292d1debfbf-light-0 span{fill:#2b2620;color:#2b2620;}#mermaid-58bcb292d1debfbf-light-0 .node rect,#mermaid-58bcb292d1debfbf-light-0 .node circle,#mermaid-58bcb292d1debfbf-light-0 .node ellipse,#mermaid-58bcb292d1debfbf-light-0 .node polygon,#mermaid-58bcb292d1debfbf-light-0 .node path{fill:#efe8db;stroke:#6b6153;stroke-width:1px;}#mermaid-58bcb292d1debfbf-light-0 .rough-node .label text,#mermaid-58bcb292d1debfbf-light-0 .node .label text,#mermaid-58bcb292d1debfbf-light-0 .image-shape .label,#mermaid-58bcb292d1debfbf-light-0 .icon-shape .label{text-anchor:middle;}#mermaid-58bcb292d1debfbf-light-0 .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-58bcb292d1debfbf-light-0 .rough-node .label,#mermaid-58bcb292d1debfbf-light-0 .node .label,#mermaid-58bcb292d1debfbf-light-0 .image-shape .label,#mermaid-58bcb292d1debfbf-light-0 .icon-shape .label{text-align:center;}#mermaid-58bcb292d1debfbf-light-0 .node.clickable{cursor:pointer;}#mermaid-58bcb292d1debfbf-light-0 .root .anchor path{fill:#6b6153!important;stroke-width:0;stroke:#6b6153;}#mermaid-58bcb292d1debfbf-light-0 .arrowheadPath{fill:rgba(255, 255, 255, 0);}#mermaid-58bcb292d1debfbf-light-0 .edgePaths .path{stroke:#6b6153;stroke-width:1px;}#mermaid-58bcb292d1debfbf-light-0 .flowchart-link{stroke:#6b6153;fill:none;}#mermaid-58bcb292d1debfbf-light-0 .edgeLabel{background-color:#f7f3ea;text-align:center;}#mermaid-58bcb292d1debfbf-light-0 .edgeLabel p{background-color:#f7f3ea;}#mermaid-58bcb292d1debfbf-light-0 .edgeLabel rect{opacity:0.5;background-color:#f7f3ea;fill:#f7f3ea;}#mermaid-58bcb292d1debfbf-light-0 .labelBkg{background-color:rgba(247, 243, 234, 0.5);}#mermaid-58bcb292d1debfbf-light-0 .cluster rect{fill:#f2ecdf;stroke:#e2d9c6;stroke-width:1px;}#mermaid-58bcb292d1debfbf-light-0 .cluster text{fill:#2b2620;}#mermaid-58bcb292d1debfbf-light-0 .cluster span{color:#2b2620;}#mermaid-58bcb292d1debfbf-light-0 .node .collapsed-indicator{fill:#e2d9c6;stroke:none;opacity:0.6;}#mermaid-58bcb292d1debfbf-light-0 .node .collapsed-separator{stroke:#e2d9c6;stroke-width:0.75px;}#mermaid-58bcb292d1debfbf-light-0 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:&quot;JetBrains Mono&quot;,&quot;Noto Sans SC Variable&quot;,ui-monospace,monospace;font-size:12px;background:#f7f3ea;border:1px solid #e2d9c6;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-58bcb292d1debfbf-light-0 .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#2b2620;}#mermaid-58bcb292d1debfbf-light-0 rect.text{fill:none;stroke-width:0;}#mermaid-58bcb292d1debfbf-light-0 .icon-shape,#mermaid-58bcb292d1debfbf-light-0 .image-shape{background-color:#f7f3ea;text-align:center;}#mermaid-58bcb292d1debfbf-light-0 .icon-shape p,#mermaid-58bcb292d1debfbf-light-0 .image-shape p{background-color:#f7f3ea;padding:2px;}#mermaid-58bcb292d1debfbf-light-0 .icon-shape .label rect,#mermaid-58bcb292d1debfbf-light-0 .image-shape .label rect{opacity:0.5;background-color:#f7f3ea;fill:#f7f3ea;}#mermaid-58bcb292d1debfbf-light-0 .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-58bcb292d1debfbf-light-0 .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-58bcb292d1debfbf-light-0 .node .neo-node{stroke:#6b6153;}#mermaid-58bcb292d1debfbf-light-0 [data-look=&quot;neo&quot;].node rect,#mermaid-58bcb292d1debfbf-light-0 [data-look=&quot;neo&quot;].cluster rect,#mermaid-58bcb292d1debfbf-light-0 [data-look=&quot;neo&quot;].node polygon{stroke:url(#mermaid-58bcb292d1debfbf-light-0-gradient);filter:drop-shadow( 1px 2px 2px rgba(185,185,185,1));}#mermaid-58bcb292d1debfbf-light-0 [data-look=&quot;neo&quot;].swimlane.cluster rect{filter:none;}#mermaid-58bcb292d1debfbf-light-0 [data-look=&quot;neo&quot;].node path{stroke:url(#mermaid-58bcb292d1debfbf-light-0-gradient);stroke-width:1px;}#mermaid-58bcb292d1debfbf-light-0 [data-look=&quot;neo&quot;].node .outer-path{filter:drop-shadow( 1px 2px 2px rgba(185,185,185,1));}#mermaid-58bcb292d1debfbf-light-0 [data-look=&quot;neo&quot;].node .neo-line path{stroke:#6b6153;filter:none;}#mermaid-58bcb292d1debfbf-light-0 [data-look=&quot;neo&quot;].node circle{stroke:url(#mermaid-58bcb292d1debfbf-light-0-gradient);filter:drop-shadow( 1px 2px 2px rgba(185,185,185,1));}#mermaid-58bcb292d1debfbf-light-0 [data-look=&quot;neo&quot;].node circle .state-start{fill:#000000;}#mermaid-58bcb292d1debfbf-light-0 [data-look=&quot;neo&quot;].icon-shape .icon{fill:url(#mermaid-58bcb292d1debfbf-light-0-gradient);filter:drop-shadow( 1px 2px 2px rgba(185,185,185,1));}#mermaid-58bcb292d1debfbf-light-0 [data-look=&quot;neo&quot;].icon-shape .icon-neo path{stroke:url(#mermaid-58bcb292d1debfbf-light-0-gradient);filter:drop-shadow( 1px 2px 2px rgba(185,185,185,1));}#mermaid-58bcb292d1debfbf-light-0 :root{--mermaid-font-family:&quot;JetBrains Mono&quot;,&quot;Noto Sans SC Variable&quot;,ui-monospace,monospace;}&lt;/style&gt;&lt;g&gt;&lt;marker id=&quot;mermaid-58bcb292d1debfbf-light-0_flowchart-v2-pointEnd&quot; class=&quot;marker flowchart-v2&quot; viewBox=&quot;0 0 10 10&quot; refX=&quot;5&quot; refY=&quot;5&quot; markerUnits=&quot;userSpaceOnUse&quot; markerWidth=&quot;8&quot; markerHeight=&quot;8&quot; orient=&quot;auto&quot;&gt;&lt;path d=&quot;M 0 0 L 10 5 L 0 10 z&quot; class=&quot;arrowMarkerPath&quot; style=&quot;stroke-width: 1; stroke-dasharray: 1, 0;&quot; /&gt;&lt;/marker&gt;&lt;marker id=&quot;mermaid-58bcb292d1debfbf-light-0_flowchart-v2-pointStart&quot; class=&quot;marker flowchart-v2&quot; viewBox=&quot;0 0 10 10&quot; refX=&quot;4.5&quot; refY=&quot;5&quot; markerUnits=&quot;userSpaceOnUse&quot; markerWidth=&quot;8&quot; markerHeight=&quot;8&quot; orient=&quot;auto&quot;&gt;&lt;path d=&quot;M 0 5 L 10 10 L 10 0 z&quot; class=&quot;arrowMarkerPath&quot; style=&quot;stroke-width: 1; stroke-dasharray: 1, 0;&quot; /&gt;&lt;/marker&gt;&lt;marker id=&quot;mermaid-58bcb292d1debfbf-light-0_flowchart-v2-pointEnd-margin&quot; class=&quot;marker flowchart-v2&quot; viewBox=&quot;0 0 11.5 14&quot; refX=&quot;11.5&quot; refY=&quot;7&quot; markerUnits=&quot;userSpaceOnUse&quot; markerWidth=&quot;10.5&quot; markerHeight=&quot;14&quot; orient=&quot;auto&quot;&gt;&lt;path d=&quot;M 0 0 L 11.5 7 L 0 14 z&quot; class=&quot;arrowMarkerPath&quot; style=&quot;stroke-width: 0; stroke-dasharray: 1, 0;&quot; /&gt;&lt;/marker&gt;&lt;marker id=&quot;mermaid-58bcb292d1debfbf-light-0_flowchart-v2-pointStart-margin&quot; class=&quot;marker flowchart-v2&quot; viewBox=&quot;0 0 11.5 14&quot; refX=&quot;1&quot; refY=&quot;7&quot; markerUnits=&quot;userSpaceOnUse&quot; markerWidth=&quot;11.5&quot; markerHeight=&quot;14&quot; orient=&quot;auto&quot;&gt;&lt;polygon points=&quot;0,7 11.5,14 11.5,0&quot; class=&quot;arrowMarkerPath&quot; style=&quot;stroke-width: 0; stroke-dasharray: 1, 0;&quot; /&gt;&lt;/marker&gt;&lt;marker id=&quot;mermaid-58bcb292d1debfbf-light-0_flowchart-v2-circleEnd&quot; class=&quot;marker flowchart-v2&quot; viewBox=&quot;0 0 10 10&quot; refX=&quot;11&quot; refY=&quot;5&quot; markerUnits=&quot;userSpaceOnUse&quot; markerWidth=&quot;11&quot; markerHeight=&quot;11&quot; orient=&quot;auto&quot;&gt;&lt;circle cx=&quot;5&quot; cy=&quot;5&quot; r=&quot;5&quot; class=&quot;arrowMarkerPath&quot; style=&quot;stroke-width: 1; stroke-dasharray: 1, 0;&quot; /&gt;&lt;/marker&gt;&lt;marker id=&quot;mermaid-58bcb292d1debfbf-light-0_flowchart-v2-circleStart&quot; class=&quot;marker flowchart-v2&quot; viewBox=&quot;0 0 10 10&quot; refX=&quot;-1&quot; refY=&quot;5&quot; markerUnits=&quot;userSpaceOnUse&quot; markerWidth=&quot;11&quot; markerHeight=&quot;11&quot; orient=&quot;auto&quot;&gt;&lt;circle cx=&quot;5&quot; cy=&quot;5&quot; r=&quot;5&quot; class=&quot;arrowMarkerPath&quot; style=&quot;stroke-width: 1; stroke-dasharray: 1, 0;&quot; /&gt;&lt;/marker&gt;&lt;marker id=&quot;mermaid-58bcb292d1debfbf-light-0_flowchart-v2-circleEnd-margin&quot; class=&quot;marker flowchart-v2&quot; viewBox=&quot;0 0 10 10&quot; refY=&quot;5&quot; refX=&quot;12.25&quot; markerUnits=&quot;userSpaceOnUse&quot; markerWidth=&quot;14&quot; markerHeight=&quot;14&quot; orient=&quot;auto&quot;&gt;&lt;circle cx=&quot;5&quot; cy=&quot;5&quot; r=&quot;5&quot; class=&quot;arrowMarkerPath&quot; style=&quot;stroke-width: 0; stroke-dasharray: 1, 0;&quot; /&gt;&lt;/marker&gt;&lt;marker id=&quot;mermaid-58bcb292d1debfbf-light-0_flowchart-v2-circleStart-margin&quot; class=&quot;marker flowchart-v2&quot; viewBox=&quot;0 0 10 10&quot; refX=&quot;-2&quot; refY=&quot;5&quot; markerUnits=&quot;userSpaceOnUse&quot; markerWidth=&quot;14&quot; markerHeight=&quot;14&quot; orient=&quot;auto&quot;&gt;&lt;circle cx=&quot;5&quot; cy=&quot;5&quot; r=&quot;5&quot; class=&quot;arrowMarkerPath&quot; style=&quot;stroke-width: 0; stroke-dasharray: 1, 0;&quot; /&gt;&lt;/marker&gt;&lt;marker id=&quot;mermaid-58bcb292d1debfbf-light-0_flowchart-v2-crossEnd&quot; class=&quot;marker cross flowchart-v2&quot; viewBox=&quot;0 0 11 11&quot; refX=&quot;12&quot; refY=&quot;5.2&quot; markerUnits=&quot;userSpaceOnUse&quot; markerWidth=&quot;11&quot; markerHeight=&quot;11&quot; orient=&quot;auto&quot;&gt;&lt;path d=&quot;M 1,1 l 9,9 M 10,1 l -9,9&quot; class=&quot;arrowMarkerPath&quot; style=&quot;stroke-width: 2; stroke-dasharray: 1, 0;&quot; /&gt;&lt;/marker&gt;&lt;marker id=&quot;mermaid-58bcb292d1debfbf-light-0_flowchart-v2-crossStart&quot; class=&quot;marker cross flowchart-v2&quot; viewBox=&quot;0 0 11 11&quot; refX=&quot;-1&quot; refY=&quot;5.2&quot; markerUnits=&quot;userSpaceOnUse&quot; markerWidth=&quot;11&quot; markerHeight=&quot;11&quot; orient=&quot;auto&quot;&gt;&lt;path d=&quot;M 1,1 l 9,9 M 10,1 l -9,9&quot; class=&quot;arrowMarkerPath&quot; style=&quot;stroke-width: 2; stroke-dasharray: 1, 0;&quot; /&gt;&lt;/marker&gt;&lt;marker id=&quot;mermaid-58bcb292d1debfbf-light-0_flowchart-v2-crossEnd-margin&quot; class=&quot;marker cross flowchart-v2&quot; viewBox=&quot;0 0 15 15&quot; refX=&quot;17.7&quot; refY=&quot;7.5&quot; markerUnits=&quot;userSpaceOnUse&quot; markerWidth=&quot;12&quot; markerHeight=&quot;12&quot; orient=&quot;auto&quot;&gt;&lt;path d=&quot;M 1,1 L 14,14 M 1,14 L 14,1&quot; class=&quot;arrowMarkerPath&quot; style=&quot;stroke-width: 2.5;&quot; /&gt;&lt;/marker&gt;&lt;marker id=&quot;mermaid-58bcb292d1debfbf-light-0_flowchart-v2-crossStart-margin&quot; class=&quot;marker cross flowchart-v2&quot; viewBox=&quot;0 0 15 15&quot; refX=&quot;-3.5&quot; refY=&quot;7.5&quot; markerUnits=&quot;userSpaceOnUse&quot; markerWidth=&quot;12&quot; markerHeight=&quot;12&quot; orient=&quot;auto&quot;&gt;&lt;path d=&quot;M 1,1 L 14,14 M 1,14 L 14,1&quot; class=&quot;arrowMarkerPath&quot; style=&quot;stroke-width: 2.5; stroke-dasharray: 1, 0;&quot; /&gt;&lt;/marker&gt;&lt;g class=&quot;root&quot;&gt;&lt;g class=&quot;clusters&quot; /&gt;&lt;g class=&quot;edgePaths&quot;&gt;&lt;path d=&quot;M123.203,75L127.37,75C131.536,75,139.87,75,147.536,75C155.203,75,162.203,75,165.703,75L169.203,75&quot; id=&quot;mermaid-58bcb292d1debfbf-light-0-L_A_B_0&quot; class=&quot;edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link&quot; style=&quot;;&quot; data-edge=&quot;true&quot; data-et=&quot;edge&quot; data-id=&quot;L_A_B_0&quot; data-points=&quot;W3sieCI6MTIzLjIwMzEyNSwieSI6NzV9LHsieCI6MTQ4LjIwMzEyNSwieSI6NzV9LHsieCI6MTczLjIwMzEyNSwieSI6NzV9XQ==&quot; data-look=&quot;classic&quot; marker-end=&quot;url(#mermaid-58bcb292d1debfbf-light-0_flowchart-v2-pointEnd)&quot; /&gt;&lt;path d=&quot;M288.917,54L297.668,49.833C306.418,45.667,323.92,37.333,336.171,33.167C348.422,29,355.422,29,358.922,29L362.422,29&quot; id=&quot;mermaid-58bcb292d1debfbf-light-0-L_B_C_0&quot; class=&quot;edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link&quot; style=&quot;;&quot; data-edge=&quot;true&quot; data-et=&quot;edge&quot; data-id=&quot;L_B_C_0&quot; data-points=&quot;W3sieCI6Mjg4LjkxNjc3OTg5MTMwNDQsInkiOjU0fSx7IngiOjM0MS40MjE4NzUsInkiOjI5fSx7IngiOjM2Ni40MjE4NzUsInkiOjI5fV0=&quot; data-look=&quot;classic&quot; marker-end=&quot;url(#mermaid-58bcb292d1debfbf-light-0_flowchart-v2-pointEnd)&quot; /&gt;&lt;path d=&quot;M537.641,29L541.807,29C545.974,29,554.307,29,565.498,32.846C576.689,36.693,590.736,44.386,597.76,48.232L604.784,52.079&quot; id=&quot;mermaid-58bcb292d1debfbf-light-0-L_C_D_0&quot; class=&quot;edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link&quot; style=&quot;;&quot; data-edge=&quot;true&quot; data-et=&quot;edge&quot; data-id=&quot;L_C_D_0&quot; data-points=&quot;W3sieCI6NTM3LjY0MDYyNSwieSI6Mjl9LHsieCI6NTYyLjY0MDYyNSwieSI6Mjl9LHsieCI6NjA4LjI5Mjc5ODkxMzA0MzUsInkiOjU0fV0=&quot; data-look=&quot;classic&quot; marker-end=&quot;url(#mermaid-58bcb292d1debfbf-light-0_flowchart-v2-pointEnd)&quot; /&gt;&lt;path d=&quot;M288.917,96L297.668,100.167C306.418,104.333,323.92,112.667,336.87,116.833C349.82,121,358.219,121,362.418,121L366.617,121&quot; id=&quot;mermaid-58bcb292d1debfbf-light-0-L_B_E_0&quot; class=&quot;edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link&quot; style=&quot;;&quot; data-edge=&quot;true&quot; data-et=&quot;edge&quot; data-id=&quot;L_B_E_0&quot; data-points=&quot;W3sieCI6Mjg4LjkxNjc3OTg5MTMwNDQsInkiOjk2fSx7IngiOjM0MS40MjE4NzUsInkiOjEyMX0seyJ4IjozNzAuNjE3MTg3NSwieSI6MTIxfV0=&quot; data-look=&quot;classic&quot; marker-end=&quot;url(#mermaid-58bcb292d1debfbf-light-0_flowchart-v2-pointEnd)&quot; /&gt;&lt;path d=&quot;M533.445,121L538.311,121C543.177,121,552.909,121,564.799,117.154C576.689,113.307,590.736,105.614,597.76,101.768L604.784,97.921&quot; id=&quot;mermaid-58bcb292d1debfbf-light-0-L_E_D_0&quot; class=&quot;edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link&quot; style=&quot;;&quot; data-edge=&quot;true&quot; data-et=&quot;edge&quot; data-id=&quot;L_E_D_0&quot; data-points=&quot;W3sieCI6NTMzLjQ0NTMxMjUsInkiOjEyMX0seyJ4Ijo1NjIuNjQwNjI1LCJ5IjoxMjF9LHsieCI6NjA4LjI5Mjc5ODkxMzA0MzUsInkiOjk2fV0=&quot; data-look=&quot;classic&quot; marker-end=&quot;url(#mermaid-58bcb292d1debfbf-light-0_flowchart-v2-pointEnd)&quot; /&gt;&lt;/g&gt;&lt;g class=&quot;edgeLabels&quot;&gt;&lt;g class=&quot;edgeLabel&quot;&gt;&lt;g class=&quot;label&quot; data-id=&quot;L_A_B_0&quot; transform=&quot;translate(0, 0)&quot;&gt;&lt;text y=&quot;-10.1&quot; text-anchor=&quot;middle&quot;&gt;&lt;tspan class=&quot;text-outer-tspan row&quot; x=&quot;0&quot; y=&quot;-0.1em&quot; dy=&quot;1.1em&quot; text-anchor=&quot;middle&quot; /&gt;&lt;/text&gt;&lt;/g&gt;&lt;/g&gt;&lt;g&gt;&lt;rect class=&quot;background&quot; style=&quot;stroke: none&quot; /&gt;&lt;/g&gt;&lt;g class=&quot;edgeLabel&quot;&gt;&lt;g class=&quot;label&quot; data-id=&quot;L_B_C_0&quot; transform=&quot;translate(0, 0)&quot;&gt;&lt;text y=&quot;-10.1&quot; text-anchor=&quot;middle&quot;&gt;&lt;tspan class=&quot;text-outer-tspan row&quot; x=&quot;0&quot; y=&quot;-0.1em&quot; dy=&quot;1.1em&quot; text-anchor=&quot;middle&quot; /&gt;&lt;/text&gt;&lt;/g&gt;&lt;/g&gt;&lt;g&gt;&lt;rect class=&quot;background&quot; style=&quot;stroke: none&quot; /&gt;&lt;/g&gt;&lt;g class=&quot;edgeLabel&quot;&gt;&lt;g class=&quot;label&quot; data-id=&quot;L_C_D_0&quot; transform=&quot;translate(0, 0)&quot;&gt;&lt;text y=&quot;-10.1&quot; text-anchor=&quot;middle&quot;&gt;&lt;tspan class=&quot;text-outer-tspan row&quot; x=&quot;0&quot; y=&quot;-0.1em&quot; dy=&quot;1.1em&quot; text-anchor=&quot;middle&quot; /&gt;&lt;/text&gt;&lt;/g&gt;&lt;/g&gt;&lt;g&gt;&lt;rect class=&quot;background&quot; style=&quot;stroke: none&quot; /&gt;&lt;/g&gt;&lt;g class=&quot;edgeLabel&quot;&gt;&lt;g class=&quot;label&quot; data-id=&quot;L_B_E_0&quot; transform=&quot;translate(0, 0)&quot;&gt;&lt;text y=&quot;-10.1&quot; text-anchor=&quot;middle&quot;&gt;&lt;tspan class=&quot;text-outer-tspan row&quot; x=&quot;0&quot; y=&quot;-0.1em&quot; dy=&quot;1.1em&quot; text-anchor=&quot;middle&quot; /&gt;&lt;/text&gt;&lt;/g&gt;&lt;/g&gt;&lt;g&gt;&lt;rect class=&quot;background&quot; style=&quot;stroke: none&quot; /&gt;&lt;/g&gt;&lt;g class=&quot;edgeLabel&quot;&gt;&lt;g class=&quot;label&quot; data-id=&quot;L_E_D_0&quot; transform=&quot;translate(0, 0)&quot;&gt;&lt;text y=&quot;-10.1&quot; text-anchor=&quot;middle&quot;&gt;&lt;tspan class=&quot;text-outer-tspan row&quot; x=&quot;0&quot; y=&quot;-0.1em&quot; dy=&quot;1.1em&quot; text-anchor=&quot;middle&quot; /&gt;&lt;/text&gt;&lt;/g&gt;&lt;/g&gt;&lt;g&gt;&lt;rect class=&quot;background&quot; style=&quot;stroke: none&quot; /&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class=&quot;nodes&quot;&gt;&lt;g class=&quot;node default&quot; id=&quot;mermaid-58bcb292d1debfbf-light-0-flowchart-A-0&quot; data-look=&quot;classic&quot; transform=&quot;translate(65.6015625, 75)&quot;&gt;&lt;rect class=&quot;basic label-container&quot; style=&quot;&quot; x=&quot;-57.6015625&quot; y=&quot;-21&quot; width=&quot;115.203125&quot; height=&quot;42&quot; /&gt;&lt;g class=&quot;label&quot; style=&quot;&quot; transform=&quot;translate(0, -9)&quot;&gt;&lt;rect /&gt;&lt;g&gt;&lt;rect class=&quot;background&quot; style=&quot;stroke: none&quot; /&gt;&lt;text y=&quot;-10.1&quot; style=&quot;&quot;&gt;&lt;tspan class=&quot;text-outer-tspan row&quot; x=&quot;0&quot; y=&quot;-0.1em&quot; dy=&quot;1.1em&quot;&gt;&lt;tspan font-style=&quot;normal&quot; class=&quot;text-inner-tspan&quot; font-weight=&quot;normal&quot;&gt;Markdown&lt;/tspan&gt;&lt;/tspan&gt;&lt;/text&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class=&quot;node default&quot; id=&quot;mermaid-58bcb292d1debfbf-light-0-flowchart-B-1&quot; data-look=&quot;classic&quot; transform=&quot;translate(244.8125, 75)&quot;&gt;&lt;rect class=&quot;basic label-container&quot; style=&quot;&quot; x=&quot;-71.609375&quot; y=&quot;-21&quot; width=&quot;143.21875&quot; height=&quot;42&quot; /&gt;&lt;g class=&quot;label&quot; style=&quot;&quot; transform=&quot;translate(0, -9)&quot;&gt;&lt;rect /&gt;&lt;g&gt;&lt;rect class=&quot;background&quot; style=&quot;stroke: none&quot; /&gt;&lt;text y=&quot;-10.1&quot; style=&quot;&quot;&gt;&lt;tspan class=&quot;text-outer-tspan row&quot; x=&quot;0&quot; y=&quot;-0.1em&quot; dy=&quot;1.1em&quot;&gt;&lt;tspan font-style=&quot;normal&quot; class=&quot;text-inner-tspan&quot; font-weight=&quot;normal&quot;&gt;Sätteri&lt;/tspan&gt;&lt;tspan font-style=&quot;normal&quot; class=&quot;text-inner-tspan&quot; font-weight=&quot;normal&quot;&gt; 解析&lt;/tspan&gt;&lt;/tspan&gt;&lt;/text&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class=&quot;node default&quot; id=&quot;mermaid-58bcb292d1debfbf-light-0-flowchart-C-3&quot; data-look=&quot;classic&quot; transform=&quot;translate(452.03125, 29)&quot;&gt;&lt;rect class=&quot;basic label-container&quot; style=&quot;&quot; x=&quot;-85.609375&quot; y=&quot;-21&quot; width=&quot;171.21875&quot; height=&quot;42&quot; /&gt;&lt;g class=&quot;label&quot; style=&quot;&quot; transform=&quot;translate(0, -9)&quot;&gt;&lt;rect /&gt;&lt;g&gt;&lt;rect class=&quot;background&quot; style=&quot;stroke: none&quot; /&gt;&lt;text y=&quot;-10.1&quot; style=&quot;&quot;&gt;&lt;tspan class=&quot;text-outer-tspan row&quot; x=&quot;0&quot; y=&quot;-0.1em&quot; dy=&quot;1.1em&quot;&gt;&lt;tspan font-style=&quot;normal&quot; class=&quot;text-inner-tspan&quot; font-weight=&quot;normal&quot;&gt;KaTeX&lt;/tspan&gt;&lt;tspan font-style=&quot;normal&quot; class=&quot;text-inner-tspan&quot; font-weight=&quot;normal&quot;&gt; /&lt;/tspan&gt;&lt;tspan font-style=&quot;normal&quot; class=&quot;text-inner-tspan&quot; font-weight=&quot;normal&quot;&gt; 代码高亮&lt;/tspan&gt;&lt;/tspan&gt;&lt;/text&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class=&quot;node default&quot; id=&quot;mermaid-58bcb292d1debfbf-light-0-flowchart-D-5&quot; data-look=&quot;classic&quot; transform=&quot;translate(646.640625, 75)&quot;&gt;&lt;rect class=&quot;basic label-container&quot; style=&quot;&quot; x=&quot;-59&quot; y=&quot;-21&quot; width=&quot;118&quot; height=&quot;42&quot; /&gt;&lt;g class=&quot;label&quot; style=&quot;&quot; transform=&quot;translate(0, -9)&quot;&gt;&lt;rect /&gt;&lt;g&gt;&lt;rect class=&quot;background&quot; style=&quot;stroke: none&quot; /&gt;&lt;text y=&quot;-10.1&quot; style=&quot;&quot;&gt;&lt;tspan class=&quot;text-outer-tspan row&quot; x=&quot;0&quot; y=&quot;-0.1em&quot; dy=&quot;1.1em&quot;&gt;&lt;tspan font-style=&quot;normal&quot; class=&quot;text-inner-tspan&quot; font-weight=&quot;normal&quot;&gt;静态&lt;/tspan&gt;&lt;tspan font-style=&quot;normal&quot; class=&quot;text-inner-tspan&quot; font-weight=&quot;normal&quot;&gt; HTML&lt;/tspan&gt;&lt;/tspan&gt;&lt;/text&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class=&quot;node default&quot; id=&quot;mermaid-58bcb292d1debfbf-light-0-flowchart-E-7&quot; data-look=&quot;classic&quot; transform=&quot;translate(452.03125, 121)&quot;&gt;&lt;rect class=&quot;basic label-container&quot; style=&quot;&quot; x=&quot;-81.4140625&quot; y=&quot;-21&quot; width=&quot;162.828125&quot; height=&quot;42&quot; /&gt;&lt;g class=&quot;label&quot; style=&quot;&quot; transform=&quot;translate(0, -9)&quot;&gt;&lt;rect /&gt;&lt;g&gt;&lt;rect class=&quot;background&quot; style=&quot;stroke: none&quot; /&gt;&lt;text y=&quot;-10.1&quot; style=&quot;&quot;&gt;&lt;tspan class=&quot;text-outer-tspan row&quot; x=&quot;0&quot; y=&quot;-0.1em&quot; dy=&quot;1.1em&quot;&gt;&lt;tspan font-style=&quot;normal&quot; class=&quot;text-inner-tspan&quot; font-weight=&quot;normal&quot;&gt;Mermaid&lt;/tspan&gt;&lt;tspan font-style=&quot;normal&quot; class=&quot;text-inner-tspan&quot; font-weight=&quot;normal&quot;&gt; →&lt;/tspan&gt;&lt;tspan font-style=&quot;normal&quot; class=&quot;text-inner-tspan&quot; font-weight=&quot;normal&quot;&gt; SVG&lt;/tspan&gt;&lt;/tspan&gt;&lt;/text&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;defs&gt;&lt;filter id=&quot;mermaid-58bcb292d1debfbf-light-0-drop-shadow&quot; height=&quot;130%&quot; width=&quot;130%&quot;&gt;&lt;feDropShadow dx=&quot;4&quot; dy=&quot;4&quot; stdDeviation=&quot;0&quot; flood-opacity=&quot;0.06&quot; flood-color=&quot;#000000&quot; /&gt;&lt;/filter&gt;&lt;/defs&gt;&lt;defs&gt;&lt;filter id=&quot;mermaid-58bcb292d1debfbf-light-0-drop-shadow-small&quot; height=&quot;150%&quot; width=&quot;150%&quot;&gt;&lt;feDropShadow dx=&quot;2&quot; dy=&quot;2&quot; stdDeviation=&quot;0&quot; flood-opacity=&quot;0.06&quot; flood-color=&quot;#000000&quot; /&gt;&lt;/filter&gt;&lt;/defs&gt;&lt;linearGradient id=&quot;mermaid-58bcb292d1debfbf-light-0-gradient&quot; gradientUnits=&quot;objectBoundingBox&quot; x1=&quot;0%&quot; y1=&quot;0%&quot; x2=&quot;100%&quot; y2=&quot;0%&quot;&gt;&lt;stop offset=&quot;0%&quot; stop-color=&quot;#6b6153&quot; stop-opacity=&quot;1&quot; /&gt;&lt;stop offset=&quot;100%&quot; stop-color=&quot;#3f6b5f&quot; stop-opacity=&quot;1&quot; /&gt;&lt;/linearGradient&gt;&lt;/svg&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;figcaption&gt;构建流程&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;Excalidraw 图用 &lt;code&gt;.excalidraw&lt;/code&gt; 文件：&lt;/p&gt;
&lt;figure class=&quot;diagram figure-wide&quot; data-diagram=&quot;excalidraw&quot; data-dv-labels=&quot;{&amp;quot;open&amp;quot;:&amp;quot;在查看器中打开 {{label}}&amp;quot;,&amp;quot;zoom&amp;quot;:&amp;quot;缩放（或双击）&amp;quot;,&amp;quot;zoomIn&amp;quot;:&amp;quot;放大&amp;quot;,&amp;quot;zoomOut&amp;quot;:&amp;quot;缩小&amp;quot;,&amp;quot;select&amp;quot;:&amp;quot;选择文本&amp;quot;,&amp;quot;selecting&amp;quot;:&amp;quot;正在选择文本&amp;quot;,&amp;quot;close&amp;quot;:&amp;quot;关闭查看器&amp;quot;,&amp;quot;hint&amp;quot;:&amp;quot;滚轮或双指缩放 · 拖动平移 · 0 适应窗口 · 1 原始大小 · Esc 关闭&amp;quot;,&amp;quot;viewerLabel&amp;quot;:&amp;quot;图表查看器&amp;quot;,&amp;quot;controlsLabel&amp;quot;:&amp;quot;图表控制&amp;quot;}&quot;&gt;
&lt;div class=&quot;diagram-canvas&quot; role=&quot;img&quot; aria-label=&quot;Markdown 到 HTML 的流程&quot;&gt;
&lt;div class=&quot;diagram-svg diagram-light&quot;&gt;&lt;svg style=&quot;max-width: 500px&quot; version=&quot;1.1&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot; viewBox=&quot;0 0 500 92&quot;&gt;&lt;!-- svg-source:excalidraw --&gt;&lt;metadata&gt;&lt;/metadata&gt;&lt;defs /&gt;&lt;g stroke-linecap=&quot;round&quot; transform=&quot;translate(10 10) rotate(0 80 36)&quot;&gt;&lt;path d=&quot;M18 0 C45.09 0, 72.17 0, 142 0 C154 0, 160 6, 160 18 C160 27.39, 160 36.79, 160 54 C160 66, 154 72, 142 72 C107.58 72, 73.15 72, 18 72 C6 72, 0 66, 0 54 C0 40.78, 0 27.55, 0 18 C0 6, 6 0, 18 0&quot; stroke=&quot;none&quot; stroke-width=&quot;0&quot; fill=&quot;#f7f3ea&quot;&gt;&lt;/path&gt;&lt;path d=&quot;M18 0 C42.86 0, 67.71 0, 142 0 M18 0 C51.65 0, 85.3 0, 142 0 M142 0 C154 0, 160 6, 160 18 M142 0 C154 0, 160 6, 160 18 M160 18 C160 31.24, 160 44.48, 160 54 M160 18 C160 30.3, 160 42.6, 160 54 M160 54 C160 66, 154 72, 142 72 M160 54 C160 66, 154 72, 142 72 M142 72 C94.52 72, 47.04 72, 18 72 M142 72 C92.67 72, 43.33 72, 18 72 M18 72 C6 72, 0 66, 0 54 M18 72 C6 72, 0 66, 0 54 M0 54 C0 40.76, 0 27.52, 0 18 M0 54 C0 42.55, 0 31.1, 0 18 M0 18 C0 6, 6 0, 18 0 M0 18 C0 6, 6 0, 18 0&quot; stroke=&quot;#1b1917&quot; stroke-width=&quot;2&quot; fill=&quot;none&quot;&gt;&lt;/path&gt;&lt;/g&gt;&lt;g stroke-linecap=&quot;round&quot; transform=&quot;translate(330 10) rotate(0 80 36)&quot;&gt;&lt;path d=&quot;M18 0 C47.56 0, 77.13 0, 142 0 C154 0, 160 6, 160 18 C160 31.91, 160 45.81, 160 54 C160 66, 154 72, 142 72 C115.58 72, 89.17 72, 18 72 C6 72, 0 66, 0 54 C0 46.42, 0 38.84, 0 18 C0 6, 6 0, 18 0&quot; stroke=&quot;none&quot; stroke-width=&quot;0&quot; fill=&quot;#efe8db&quot;&gt;&lt;/path&gt;&lt;path d=&quot;M18 0 C42.86 0, 67.71 0, 142 0 M18 0 C60.58 0, 103.16 0, 142 0 M142 0 C154 0, 160 6, 160 18 M142 0 C154 0, 160 6, 160 18 M160 18 C160 31.87, 160 45.74, 160 54 M160 18 C160 29.92, 160 41.85, 160 54 M160 54 C160 66, 154 72, 142 72 M160 54 C160 66, 154 72, 142 72 M142 72 C92.57 72, 43.15 72, 18 72 M142 72 C115.5 72, 89.01 72, 18 72 M18 72 C6 72, 0 66, 0 54 M18 72 C6 72, 0 66, 0 54 M0 54 C0 44.84, 0 35.67, 0 18 M0 54 C0 39.8, 0 25.6, 0 18 M0 18 C0 6, 6 0, 18 0 M0 18 C0 6, 6 0, 18 0&quot; stroke=&quot;#1b1917&quot; stroke-width=&quot;2&quot; fill=&quot;none&quot;&gt;&lt;/path&gt;&lt;/g&gt;&lt;g stroke-linecap=&quot;round&quot;&gt;&lt;g transform=&quot;translate(170 46) rotate(0 80 0)&quot;&gt;&lt;path d=&quot;M0 0 C26.67 0, 133.33 0, 160 0 M0 0 C26.67 0, 133.33 0, 160 0&quot; stroke=&quot;#1b1917&quot; stroke-width=&quot;2&quot; fill=&quot;none&quot;&gt;&lt;/path&gt;&lt;/g&gt;&lt;g transform=&quot;translate(170 46) rotate(0 80 0)&quot;&gt;&lt;path d=&quot;M136.51 8.55 C141.22 6.84, 145.93 5.12, 160 0 M136.51 8.55 C141.57 6.71, 146.63 4.87, 160 0&quot; stroke=&quot;#1b1917&quot; stroke-width=&quot;2&quot; fill=&quot;none&quot;&gt;&lt;/path&gt;&lt;/g&gt;&lt;g transform=&quot;translate(170 46) rotate(0 80 0)&quot;&gt;&lt;path d=&quot;M136.51 -8.55 C141.22 -6.84, 145.93 -5.12, 160 0 M136.51 -8.55 C141.57 -6.71, 146.63 -4.87, 160 0&quot; stroke=&quot;#1b1917&quot; stroke-width=&quot;2&quot; fill=&quot;none&quot;&gt;&lt;/path&gt;&lt;/g&gt;&lt;/g&gt;&lt;mask&gt;&lt;/mask&gt;&lt;g transform=&quot;translate(46 36) rotate(0 45 10)&quot;&gt;&lt;text x=&quot;0&quot; y=&quot;14.096&quot; font-family=&quot;Virgil, sans-serif, Segoe UI Emoji&quot; font-size=&quot;16px&quot; fill=&quot;#1b1917&quot; text-anchor=&quot;start&quot; style=&quot;white-space: pre;&quot; direction=&quot;ltr&quot; dominant-baseline=&quot;alphabetic&quot;&gt;Markdown&lt;/text&gt;&lt;/g&gt;&lt;g transform=&quot;translate(370 36) rotate(0 45 10)&quot;&gt;&lt;text x=&quot;0&quot; y=&quot;14.096&quot; font-family=&quot;Virgil, sans-serif, Segoe UI Emoji&quot; font-size=&quot;16px&quot; fill=&quot;#1b1917&quot; text-anchor=&quot;start&quot; style=&quot;white-space: pre;&quot; direction=&quot;ltr&quot; dominant-baseline=&quot;alphabetic&quot;&gt;HTML&lt;/text&gt;&lt;/g&gt;&lt;/svg&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;figcaption&gt;Markdown 到 HTML 的流程&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;图表在构建期渲染成内联 SVG，可以选中文字、可以被搜索；点击图上角的按钮还能全屏缩放查看。&lt;/p&gt;
&lt;h2 id=&quot;图片&quot;&gt;图片&lt;/h2&gt;
&lt;p&gt;普通图片：&lt;/p&gt;
&lt;p&gt;&lt;img alt=&quot;本站的配色&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;640&quot; height=&quot;200&quot; src=&quot;https://io.chaos-ljc.top/_astro/palette.C7u4PjmR_ZOXW4r.svg&quot;&gt;&lt;/p&gt;
&lt;p&gt;在图片标题里写 &lt;code&gt;wide&lt;/code&gt; 可以让图片比正文栏更宽，写 &lt;code&gt;full&lt;/code&gt; 则撑满整个视口：&lt;/p&gt;
&lt;figure class=&quot;figure-wide&quot;&gt;&lt;img alt=&quot;本站的配色（宽图）&quot; title=&quot;&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;640&quot; height=&quot;200&quot; src=&quot;https://io.chaos-ljc.top/_astro/palette.C7u4PjmR_ZOXW4r.svg&quot;&gt;&lt;figcaption&gt;本站的配色（宽图）&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h2 id=&quot;脚注&quot;&gt;脚注&lt;/h2&gt;
&lt;p&gt;脚注用来放补充说明&lt;sup&gt;&lt;a href=&quot;https://io.chaos-ljc.top/posts/markdown-example/#user-content-fn-1&quot; id=&quot;user-content-fnref-1&quot; data-footnote-ref=&quot;&quot; aria-describedby=&quot;footnote-label&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;，引用处会自动编号&lt;sup&gt;&lt;a href=&quot;https://io.chaos-ljc.top/posts/markdown-example/#user-content-fn-2&quot; id=&quot;user-content-fnref-2&quot; data-footnote-ref=&quot;&quot; aria-describedby=&quot;footnote-label&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;。&lt;/p&gt;
&lt;h2 id=&quot;分割线&quot;&gt;分割线&lt;/h2&gt;
&lt;p&gt;正文里用三个短横线就能插入一条分割线：&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&quot;就这些&quot;&gt;就这些&lt;/h2&gt;
&lt;p&gt;上面覆盖了本站支持的全部写法。写作时有任何拿不准的，参照本页即可。&lt;/p&gt;
&lt;section data-footnotes=&quot;&quot; class=&quot;footnotes&quot;&gt;&lt;h2 class=&quot;sr-only&quot; id=&quot;footnote-label&quot;&gt;Footnotes&lt;/h2&gt;
&lt;ol&gt;
&lt;li id=&quot;user-content-fn-1&quot;&gt;
&lt;p&gt;脚注的内容渲染在文章末尾。 &lt;a href=&quot;https://io.chaos-ljc.top/posts/markdown-example/#user-content-fnref-1&quot; data-footnote-backref=&quot;&quot; aria-label=&quot;Back to reference 1&quot; class=&quot;data-footnote-backref&quot;&gt;↩&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id=&quot;user-content-fn-2&quot;&gt;
&lt;p&gt;也可以有多个脚注。 &lt;a href=&quot;https://io.chaos-ljc.top/posts/markdown-example/#user-content-fnref-2&quot; data-footnote-backref=&quot;&quot; aria-label=&quot;Back to reference 2&quot; class=&quot;data-footnote-backref&quot;&gt;↩&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/section&gt;
</content:encoded><dc:creator>chaos</dc:creator><category>Markdown</category><category>样例</category></item><item><title>「洛谷 P3385」负环复盘</title><link>https://io.chaos-ljc.top/posts/p3385-negative-cycle/</link><guid isPermaLink="true">https://io.chaos-ljc.top/posts/p3385-negative-cycle/</guid><description>用 SPFA 判负环，真正卡住我的不是算法，而是三个容易写错的细节。</description><pubDate>Sat, 24 Oct 2026 12:00:00 GMT</pubDate><content:encoded>&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;题目&lt;/strong&gt;：洛谷 &lt;a href=&quot;https://www.luogu.com.cn/problem/P3385&quot; class=&quot;link-external&quot; rel=&quot;noopener&quot;&gt;P3385 【模板】负环&lt;/a&gt; · 普及+&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;时空限制&lt;/strong&gt;：1s / 128MB&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;p&gt;这是一篇&lt;strong&gt;复盘&lt;/strong&gt;，不是完整题解。题目本身很简单：给一张有向图，判断图中是否存在负环。&lt;/p&gt;
&lt;h2 id=&quot;我卡住的地方&quot;&gt;我卡住的地方&lt;/h2&gt;
&lt;h3 id=&quot;1-队列里到底放什么&quot;&gt;1. 队列里到底放什么&lt;/h3&gt;
&lt;p&gt;一开始我把“松弛成功的次数”当成判负环的依据，跑大数据直接 TLE。正确的做法是&lt;strong&gt;统计路径长度&lt;/strong&gt;：维护 &lt;code&gt;cnt[v]&lt;/code&gt;，表示当前到达 &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;v&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;v&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; 的这条路径上有多少条边。&lt;/p&gt;
&lt;div class=&quot;math-display&quot; tabindex=&quot;0&quot;&gt;&lt;span class=&quot;katex-display&quot;&gt;&lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;c&lt;/mi&gt;&lt;mi&gt;n&lt;/mi&gt;&lt;mi&gt;t&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;[&lt;/mo&gt;&lt;mi&gt;v&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;]&lt;/mo&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mi&gt;c&lt;/mi&gt;&lt;mi&gt;n&lt;/mi&gt;&lt;mi&gt;t&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;[&lt;/mo&gt;&lt;mi&gt;u&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;]&lt;/mo&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;cnt[v] = cnt[u] + 1&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;只要存在一个点满足 &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;c&lt;/mi&gt;&lt;mi&gt;n&lt;/mi&gt;&lt;mi&gt;t&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;[&lt;/mo&gt;&lt;mi&gt;v&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;]&lt;/mo&gt;&lt;mo&gt;≥&lt;/mo&gt;&lt;mi&gt;n&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;cnt[v] \ge n&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;，就说明这条路径上有重复的点，即存在负环。&lt;/p&gt;
&lt;h3 id=&quot;2-为什么不能用-visited-数组&quot;&gt;2. 为什么不能用 &lt;code&gt;visited&lt;/code&gt; 数组&lt;/h3&gt;
&lt;p&gt;SPFA 的 &lt;code&gt;inQueue&lt;/code&gt; 只是“这个点现在在不在队列里”，跟负环判定没有直接关系。用它判负环会漏判或误判。&lt;/p&gt;
&lt;h3 id=&quot;3-环上权值和必须是负数&quot;&gt;3. 环上权值和必须是负数&lt;/h3&gt;
&lt;p&gt;注意题目问的是&lt;strong&gt;负环&lt;/strong&gt;而不是&lt;strong&gt;零环&lt;/strong&gt;。正权环和零权环都不该判为有解。&lt;/p&gt;
&lt;h2 id=&quot;最终代码&quot;&gt;最终代码&lt;/h2&gt;
&lt;div class=&quot;expressive-code&quot;&gt;&lt;figure class=&quot;frame has-title&quot;&gt;&lt;figcaption class=&quot;header&quot;&gt;&lt;span class=&quot;title&quot;&gt;P3385.cpp&lt;/span&gt;&lt;/figcaption&gt;&lt;pre data-language=&quot;cpp&quot;&gt;&lt;code&gt;&lt;div class=&quot;ec-line highlight mark&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;include&lt;/span&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;--0:#68640C;--1:#B8BB26&quot;&gt;bits/stdc++.h&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line highlight mark&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#9D0006;--1:#FB5D4A&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt;namespace&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;std&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt;struct&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;Edge&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;to&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;w&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;};&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;main&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;ios&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;sync_with_stdio&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;cin&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;tie&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;nullptr&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line highlight mark&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;m&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line highlight mark&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;cin&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;m&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line highlight mark&quot;&gt;&lt;div class=&quot;code&quot;&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;vector&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;vector&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;Edge&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;g&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#9D0006;--1:#FB5D4A&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;m&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;++&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;u&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;v&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;w&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;cin&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;u&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;v&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;w&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;g&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;u&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;push_back&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;v&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;w&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#6A5F54;--0fs:italic;--1:#9D9082;--1fs:italic&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#6A5F54;--0fs:italic;--1:#9D9082;--1fs:italic&quot;&gt;// 所有点距离置 0 并全部入队，等价于超级源点连向所有点&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;vector&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;dist&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;cnt&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;queue&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;q&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;vector&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt;bool&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;inQueue&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#9D0006;--1:#FB5D4A&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;&amp;lt;=&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;++&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;q&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;push&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt;bool&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;hasNegativeCycle&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#9D0006;--1:#FB5D4A&quot;&gt;while&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#9D0006;--1:#FB5D4A&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;q&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;empty&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;())&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;u&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;q&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;front&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;();&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;q&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;pop&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;();&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;inQueue&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;u&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;--0:#9D0006;--1:#FB5D4A&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt;auto&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;v&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;w&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;g&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;u&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;])&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;            &lt;/span&gt;&lt;span style=&quot;--0:#9D0006;--1:#FB5D4A&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;dist&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;v&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;dist&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;u&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;w&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;                &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;dist&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;v&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;dist&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;u&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;w&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;                &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;cnt&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;v&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;cnt&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;u&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;                &lt;/span&gt;&lt;span style=&quot;--0:#9D0006;--1:#FB5D4A&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;cnt&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;v&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;&amp;gt;=&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;n&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;                    &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;hasNegativeCycle&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;                    &lt;/span&gt;&lt;span style=&quot;--0:#9D0006;--1:#FB5D4A&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;                &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;                &lt;/span&gt;&lt;span style=&quot;--0:#9D0006;--1:#FB5D4A&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#9D0006;--1:#FB5D4A&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;inQueue&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;v&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;])&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;                    &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;q&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;push&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;v&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;                    &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;inQueue&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;v&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;                &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;            &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;--0:#9D0006;--1:#FB5D4A&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;hasNegativeCycle&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#9D0006;--1:#FB5D4A&quot;&gt;break&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;cout&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;hasNegativeCycle&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;?&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--0:#68640C;--1:#B8BB26&quot;&gt;YES&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--0:#68640C;--1:#B8BB26&quot;&gt;NO&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;&apos;&lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;&apos;&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#9D0006;--1:#FB5D4A&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;</content:encoded><dc:creator>chaos</dc:creator><category>洛谷</category><category>P3385</category><category>SPFA</category><category>最短路</category><category>复盘</category></item><item><title>单调栈：从「柱状图中最大的矩形」说起</title><link>https://io.chaos-ljc.top/posts/monotonic-stack/</link><guid isPermaLink="true">https://io.chaos-ljc.top/posts/monotonic-stack/</guid><description>把 O(n²) 的区间最小值枚举压到 O(n)，顺便说清楚单调栈到底在维护什么。</description><pubDate>Wed, 21 Oct 2026 02:30:00 GMT</pubDate><content:encoded>&lt;h2 id=&quot;问题&quot;&gt;问题&lt;/h2&gt;
&lt;p&gt;给定一个柱状图的高度数组 &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;h&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;h&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;，求柱状图中能勾勒出的&lt;strong&gt;最大矩形&lt;/strong&gt;面积。&lt;/p&gt;
&lt;p&gt;暴力做法是枚举左右边界 &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;O&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;n&lt;/mi&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/msup&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;O(n^2)&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;，再用区间最小值算面积，还是 &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;O&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;n&lt;/mi&gt;&lt;mn&gt;3&lt;/mn&gt;&lt;/msup&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;O(n^3)&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;。我们想把复杂度压到 &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;O&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;n&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;O(n)&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;。&lt;/p&gt;
&lt;h2 id=&quot;换一个问法&quot;&gt;换一个问法&lt;/h2&gt;
&lt;p&gt;与其枚举区间，不如换个角度：&lt;strong&gt;枚举“谁是最低的那根柱子”&lt;/strong&gt;。&lt;/p&gt;
&lt;p&gt;如果第 &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;i&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; 根柱子作为矩形里最低的柱子，那么矩形的左右边界分别是：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mi&gt;L&lt;/mi&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;/msub&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;L_i&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;：左边第一个&lt;strong&gt;严格小于&lt;/strong&gt; &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mi&gt;h&lt;/mi&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;/msub&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;h_i&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; 的位置；&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mi&gt;R&lt;/mi&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;/msub&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;R_i&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;：右边第一个&lt;strong&gt;严格小于&lt;/strong&gt; &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mi&gt;h&lt;/mi&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;/msub&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;h_i&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; 的位置。&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;于是以 &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;i&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; 为最低柱的最大矩形面积就是：&lt;/p&gt;
&lt;div class=&quot;math-display&quot; tabindex=&quot;0&quot;&gt;&lt;span class=&quot;katex-display&quot;&gt;&lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;/msub&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;msub&gt;&lt;mi&gt;h&lt;/mi&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;/msub&gt;&lt;mo&gt;×&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;msub&gt;&lt;mi&gt;R&lt;/mi&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;/msub&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;msub&gt;&lt;mi&gt;L&lt;/mi&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;/msub&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;A_i = h_i \times (R_i - L_i - 1)&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;答案取 &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;max&lt;/mi&gt;&lt;mo&gt;⁡&lt;/mo&gt;&lt;msub&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;/msub&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;\max A_i&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;。现在问题变成：&lt;strong&gt;怎么在线性时间内求出每个位置的左右第一个更小值？&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id=&quot;单调栈&quot;&gt;单调栈&lt;/h2&gt;
&lt;p&gt;维护一个栈，栈里存下标，对应的高度&lt;strong&gt;单调递增&lt;/strong&gt;（栈底到栈顶）。从左往右扫描：&lt;/p&gt;
&lt;figure class=&quot;diagram&quot; data-diagram=&quot;mermaid&quot; data-dv-labels=&quot;{&amp;quot;open&amp;quot;:&amp;quot;在查看器中打开 {{label}}&amp;quot;,&amp;quot;zoom&amp;quot;:&amp;quot;缩放（或双击）&amp;quot;,&amp;quot;zoomIn&amp;quot;:&amp;quot;放大&amp;quot;,&amp;quot;zoomOut&amp;quot;:&amp;quot;缩小&amp;quot;,&amp;quot;select&amp;quot;:&amp;quot;选择文本&amp;quot;,&amp;quot;selecting&amp;quot;:&amp;quot;正在选择文本&amp;quot;,&amp;quot;close&amp;quot;:&amp;quot;关闭查看器&amp;quot;,&amp;quot;hint&amp;quot;:&amp;quot;滚轮或双指缩放 · 拖动平移 · 0 适应窗口 · 1 原始大小 · Esc 关闭&amp;quot;,&amp;quot;viewerLabel&amp;quot;:&amp;quot;图表查看器&amp;quot;,&amp;quot;controlsLabel&amp;quot;:&amp;quot;图表控制&amp;quot;}&quot;&gt;
&lt;div class=&quot;diagram-canvas&quot; role=&quot;img&quot; aria-label=&quot;单调栈的入栈与出栈&quot;&gt;
&lt;div class=&quot;diagram-svg diagram-light&quot;&gt;&lt;svg id=&quot;mermaid-2eb12da36bc43bdc-light-0&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot; xmlns:xlink=&quot;http://www.w3.org/1999/xlink&quot; class=&quot;flowchart&quot; style=&quot;max-width: 619.25px;&quot; viewBox=&quot;0 0 619.25 192.30624389648438&quot; role=&quot;graphics-document document&quot; aria-roledescription=&quot;flowchart-v2&quot;&gt;&lt;style&gt;#mermaid-2eb12da36bc43bdc-light-0{font-family:&quot;JetBrains Mono&quot;,&quot;Noto Sans SC Variable&quot;,ui-monospace,monospace;font-size:14px;fill:#2b2620;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-2eb12da36bc43bdc-light-0 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-2eb12da36bc43bdc-light-0 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-2eb12da36bc43bdc-light-0 .error-icon{fill:#f7f3ea;}#mermaid-2eb12da36bc43bdc-light-0 .error-text{fill:#2b2620;stroke:#2b2620;}#mermaid-2eb12da36bc43bdc-light-0 .edge-thickness-normal{stroke-width:1px;}#mermaid-2eb12da36bc43bdc-light-0 .edge-thickness-thick{stroke-width:3.5px;}#mermaid-2eb12da36bc43bdc-light-0 .edge-pattern-solid{stroke-dasharray:0;}#mermaid-2eb12da36bc43bdc-light-0 .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-2eb12da36bc43bdc-light-0 .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-2eb12da36bc43bdc-light-0 .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-2eb12da36bc43bdc-light-0 .marker{fill:#6b6153;stroke:#6b6153;}#mermaid-2eb12da36bc43bdc-light-0 .marker.cross{stroke:#6b6153;}#mermaid-2eb12da36bc43bdc-light-0 svg{font-family:&quot;JetBrains Mono&quot;,&quot;Noto Sans SC Variable&quot;,ui-monospace,monospace;font-size:14px;}#mermaid-2eb12da36bc43bdc-light-0 p{margin:0;}#mermaid-2eb12da36bc43bdc-light-0 .label{font-family:&quot;JetBrains Mono&quot;,&quot;Noto Sans SC Variable&quot;,ui-monospace,monospace;color:#2b2620;}#mermaid-2eb12da36bc43bdc-light-0 .cluster-label text{fill:#2b2620;}#mermaid-2eb12da36bc43bdc-light-0 .cluster-label span{color:#2b2620;}#mermaid-2eb12da36bc43bdc-light-0 .cluster-label span p{background-color:transparent;}#mermaid-2eb12da36bc43bdc-light-0 .label text,#mermaid-2eb12da36bc43bdc-light-0 span{fill:#2b2620;color:#2b2620;}#mermaid-2eb12da36bc43bdc-light-0 .node rect,#mermaid-2eb12da36bc43bdc-light-0 .node circle,#mermaid-2eb12da36bc43bdc-light-0 .node ellipse,#mermaid-2eb12da36bc43bdc-light-0 .node polygon,#mermaid-2eb12da36bc43bdc-light-0 .node path{fill:#efe8db;stroke:#6b6153;stroke-width:1px;}#mermaid-2eb12da36bc43bdc-light-0 .rough-node .label text,#mermaid-2eb12da36bc43bdc-light-0 .node .label text,#mermaid-2eb12da36bc43bdc-light-0 .image-shape .label,#mermaid-2eb12da36bc43bdc-light-0 .icon-shape .label{text-anchor:middle;}#mermaid-2eb12da36bc43bdc-light-0 .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-2eb12da36bc43bdc-light-0 .rough-node .label,#mermaid-2eb12da36bc43bdc-light-0 .node .label,#mermaid-2eb12da36bc43bdc-light-0 .image-shape .label,#mermaid-2eb12da36bc43bdc-light-0 .icon-shape .label{text-align:center;}#mermaid-2eb12da36bc43bdc-light-0 .node.clickable{cursor:pointer;}#mermaid-2eb12da36bc43bdc-light-0 .root .anchor path{fill:#6b6153!important;stroke-width:0;stroke:#6b6153;}#mermaid-2eb12da36bc43bdc-light-0 .arrowheadPath{fill:rgba(255, 255, 255, 0);}#mermaid-2eb12da36bc43bdc-light-0 .edgePaths .path{stroke:#6b6153;stroke-width:1px;}#mermaid-2eb12da36bc43bdc-light-0 .flowchart-link{stroke:#6b6153;fill:none;}#mermaid-2eb12da36bc43bdc-light-0 .edgeLabel{background-color:#f7f3ea;text-align:center;}#mermaid-2eb12da36bc43bdc-light-0 .edgeLabel p{background-color:#f7f3ea;}#mermaid-2eb12da36bc43bdc-light-0 .edgeLabel rect{opacity:0.5;background-color:#f7f3ea;fill:#f7f3ea;}#mermaid-2eb12da36bc43bdc-light-0 .labelBkg{background-color:rgba(247, 243, 234, 0.5);}#mermaid-2eb12da36bc43bdc-light-0 .cluster rect{fill:#f2ecdf;stroke:#e2d9c6;stroke-width:1px;}#mermaid-2eb12da36bc43bdc-light-0 .cluster text{fill:#2b2620;}#mermaid-2eb12da36bc43bdc-light-0 .cluster span{color:#2b2620;}#mermaid-2eb12da36bc43bdc-light-0 .node .collapsed-indicator{fill:#e2d9c6;stroke:none;opacity:0.6;}#mermaid-2eb12da36bc43bdc-light-0 .node .collapsed-separator{stroke:#e2d9c6;stroke-width:0.75px;}#mermaid-2eb12da36bc43bdc-light-0 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:&quot;JetBrains Mono&quot;,&quot;Noto Sans SC Variable&quot;,ui-monospace,monospace;font-size:12px;background:#f7f3ea;border:1px solid #e2d9c6;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-2eb12da36bc43bdc-light-0 .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#2b2620;}#mermaid-2eb12da36bc43bdc-light-0 rect.text{fill:none;stroke-width:0;}#mermaid-2eb12da36bc43bdc-light-0 .icon-shape,#mermaid-2eb12da36bc43bdc-light-0 .image-shape{background-color:#f7f3ea;text-align:center;}#mermaid-2eb12da36bc43bdc-light-0 .icon-shape p,#mermaid-2eb12da36bc43bdc-light-0 .image-shape p{background-color:#f7f3ea;padding:2px;}#mermaid-2eb12da36bc43bdc-light-0 .icon-shape .label rect,#mermaid-2eb12da36bc43bdc-light-0 .image-shape .label rect{opacity:0.5;background-color:#f7f3ea;fill:#f7f3ea;}#mermaid-2eb12da36bc43bdc-light-0 .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-2eb12da36bc43bdc-light-0 .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-2eb12da36bc43bdc-light-0 .node .neo-node{stroke:#6b6153;}#mermaid-2eb12da36bc43bdc-light-0 [data-look=&quot;neo&quot;].node rect,#mermaid-2eb12da36bc43bdc-light-0 [data-look=&quot;neo&quot;].cluster rect,#mermaid-2eb12da36bc43bdc-light-0 [data-look=&quot;neo&quot;].node polygon{stroke:url(#mermaid-2eb12da36bc43bdc-light-0-gradient);filter:drop-shadow( 1px 2px 2px rgba(185,185,185,1));}#mermaid-2eb12da36bc43bdc-light-0 [data-look=&quot;neo&quot;].swimlane.cluster rect{filter:none;}#mermaid-2eb12da36bc43bdc-light-0 [data-look=&quot;neo&quot;].node path{stroke:url(#mermaid-2eb12da36bc43bdc-light-0-gradient);stroke-width:1px;}#mermaid-2eb12da36bc43bdc-light-0 [data-look=&quot;neo&quot;].node .outer-path{filter:drop-shadow( 1px 2px 2px rgba(185,185,185,1));}#mermaid-2eb12da36bc43bdc-light-0 [data-look=&quot;neo&quot;].node .neo-line path{stroke:#6b6153;filter:none;}#mermaid-2eb12da36bc43bdc-light-0 [data-look=&quot;neo&quot;].node circle{stroke:url(#mermaid-2eb12da36bc43bdc-light-0-gradient);filter:drop-shadow( 1px 2px 2px rgba(185,185,185,1));}#mermaid-2eb12da36bc43bdc-light-0 [data-look=&quot;neo&quot;].node circle .state-start{fill:#000000;}#mermaid-2eb12da36bc43bdc-light-0 [data-look=&quot;neo&quot;].icon-shape .icon{fill:url(#mermaid-2eb12da36bc43bdc-light-0-gradient);filter:drop-shadow( 1px 2px 2px rgba(185,185,185,1));}#mermaid-2eb12da36bc43bdc-light-0 [data-look=&quot;neo&quot;].icon-shape .icon-neo path{stroke:url(#mermaid-2eb12da36bc43bdc-light-0-gradient);filter:drop-shadow( 1px 2px 2px rgba(185,185,185,1));}#mermaid-2eb12da36bc43bdc-light-0 :root{--mermaid-font-family:&quot;JetBrains Mono&quot;,&quot;Noto Sans SC Variable&quot;,ui-monospace,monospace;}&lt;/style&gt;&lt;g&gt;&lt;marker id=&quot;mermaid-2eb12da36bc43bdc-light-0_flowchart-v2-pointEnd&quot; class=&quot;marker flowchart-v2&quot; viewBox=&quot;0 0 10 10&quot; refX=&quot;5&quot; refY=&quot;5&quot; markerUnits=&quot;userSpaceOnUse&quot; markerWidth=&quot;8&quot; markerHeight=&quot;8&quot; orient=&quot;auto&quot;&gt;&lt;path d=&quot;M 0 0 L 10 5 L 0 10 z&quot; class=&quot;arrowMarkerPath&quot; style=&quot;stroke-width: 1; stroke-dasharray: 1, 0;&quot; /&gt;&lt;/marker&gt;&lt;marker id=&quot;mermaid-2eb12da36bc43bdc-light-0_flowchart-v2-pointStart&quot; class=&quot;marker flowchart-v2&quot; viewBox=&quot;0 0 10 10&quot; refX=&quot;4.5&quot; refY=&quot;5&quot; markerUnits=&quot;userSpaceOnUse&quot; markerWidth=&quot;8&quot; markerHeight=&quot;8&quot; orient=&quot;auto&quot;&gt;&lt;path d=&quot;M 0 5 L 10 10 L 10 0 z&quot; class=&quot;arrowMarkerPath&quot; style=&quot;stroke-width: 1; stroke-dasharray: 1, 0;&quot; /&gt;&lt;/marker&gt;&lt;marker id=&quot;mermaid-2eb12da36bc43bdc-light-0_flowchart-v2-pointEnd-margin&quot; class=&quot;marker flowchart-v2&quot; viewBox=&quot;0 0 11.5 14&quot; refX=&quot;11.5&quot; refY=&quot;7&quot; markerUnits=&quot;userSpaceOnUse&quot; markerWidth=&quot;10.5&quot; markerHeight=&quot;14&quot; orient=&quot;auto&quot;&gt;&lt;path d=&quot;M 0 0 L 11.5 7 L 0 14 z&quot; class=&quot;arrowMarkerPath&quot; style=&quot;stroke-width: 0; stroke-dasharray: 1, 0;&quot; /&gt;&lt;/marker&gt;&lt;marker id=&quot;mermaid-2eb12da36bc43bdc-light-0_flowchart-v2-pointStart-margin&quot; class=&quot;marker flowchart-v2&quot; viewBox=&quot;0 0 11.5 14&quot; refX=&quot;1&quot; refY=&quot;7&quot; markerUnits=&quot;userSpaceOnUse&quot; markerWidth=&quot;11.5&quot; markerHeight=&quot;14&quot; orient=&quot;auto&quot;&gt;&lt;polygon points=&quot;0,7 11.5,14 11.5,0&quot; class=&quot;arrowMarkerPath&quot; style=&quot;stroke-width: 0; stroke-dasharray: 1, 0;&quot; /&gt;&lt;/marker&gt;&lt;marker id=&quot;mermaid-2eb12da36bc43bdc-light-0_flowchart-v2-circleEnd&quot; class=&quot;marker flowchart-v2&quot; viewBox=&quot;0 0 10 10&quot; refX=&quot;11&quot; refY=&quot;5&quot; markerUnits=&quot;userSpaceOnUse&quot; markerWidth=&quot;11&quot; markerHeight=&quot;11&quot; orient=&quot;auto&quot;&gt;&lt;circle cx=&quot;5&quot; cy=&quot;5&quot; r=&quot;5&quot; class=&quot;arrowMarkerPath&quot; style=&quot;stroke-width: 1; stroke-dasharray: 1, 0;&quot; /&gt;&lt;/marker&gt;&lt;marker id=&quot;mermaid-2eb12da36bc43bdc-light-0_flowchart-v2-circleStart&quot; class=&quot;marker flowchart-v2&quot; viewBox=&quot;0 0 10 10&quot; refX=&quot;-1&quot; refY=&quot;5&quot; markerUnits=&quot;userSpaceOnUse&quot; markerWidth=&quot;11&quot; markerHeight=&quot;11&quot; orient=&quot;auto&quot;&gt;&lt;circle cx=&quot;5&quot; cy=&quot;5&quot; r=&quot;5&quot; class=&quot;arrowMarkerPath&quot; style=&quot;stroke-width: 1; stroke-dasharray: 1, 0;&quot; /&gt;&lt;/marker&gt;&lt;marker id=&quot;mermaid-2eb12da36bc43bdc-light-0_flowchart-v2-circleEnd-margin&quot; class=&quot;marker flowchart-v2&quot; viewBox=&quot;0 0 10 10&quot; refY=&quot;5&quot; refX=&quot;12.25&quot; markerUnits=&quot;userSpaceOnUse&quot; markerWidth=&quot;14&quot; markerHeight=&quot;14&quot; orient=&quot;auto&quot;&gt;&lt;circle cx=&quot;5&quot; cy=&quot;5&quot; r=&quot;5&quot; class=&quot;arrowMarkerPath&quot; style=&quot;stroke-width: 0; stroke-dasharray: 1, 0;&quot; /&gt;&lt;/marker&gt;&lt;marker id=&quot;mermaid-2eb12da36bc43bdc-light-0_flowchart-v2-circleStart-margin&quot; class=&quot;marker flowchart-v2&quot; viewBox=&quot;0 0 10 10&quot; refX=&quot;-2&quot; refY=&quot;5&quot; markerUnits=&quot;userSpaceOnUse&quot; markerWidth=&quot;14&quot; markerHeight=&quot;14&quot; orient=&quot;auto&quot;&gt;&lt;circle cx=&quot;5&quot; cy=&quot;5&quot; r=&quot;5&quot; class=&quot;arrowMarkerPath&quot; style=&quot;stroke-width: 0; stroke-dasharray: 1, 0;&quot; /&gt;&lt;/marker&gt;&lt;marker id=&quot;mermaid-2eb12da36bc43bdc-light-0_flowchart-v2-crossEnd&quot; class=&quot;marker cross flowchart-v2&quot; viewBox=&quot;0 0 11 11&quot; refX=&quot;12&quot; refY=&quot;5.2&quot; markerUnits=&quot;userSpaceOnUse&quot; markerWidth=&quot;11&quot; markerHeight=&quot;11&quot; orient=&quot;auto&quot;&gt;&lt;path d=&quot;M 1,1 l 9,9 M 10,1 l -9,9&quot; class=&quot;arrowMarkerPath&quot; style=&quot;stroke-width: 2; stroke-dasharray: 1, 0;&quot; /&gt;&lt;/marker&gt;&lt;marker id=&quot;mermaid-2eb12da36bc43bdc-light-0_flowchart-v2-crossStart&quot; class=&quot;marker cross flowchart-v2&quot; viewBox=&quot;0 0 11 11&quot; refX=&quot;-1&quot; refY=&quot;5.2&quot; markerUnits=&quot;userSpaceOnUse&quot; markerWidth=&quot;11&quot; markerHeight=&quot;11&quot; orient=&quot;auto&quot;&gt;&lt;path d=&quot;M 1,1 l 9,9 M 10,1 l -9,9&quot; class=&quot;arrowMarkerPath&quot; style=&quot;stroke-width: 2; stroke-dasharray: 1, 0;&quot; /&gt;&lt;/marker&gt;&lt;marker id=&quot;mermaid-2eb12da36bc43bdc-light-0_flowchart-v2-crossEnd-margin&quot; class=&quot;marker cross flowchart-v2&quot; viewBox=&quot;0 0 15 15&quot; refX=&quot;17.7&quot; refY=&quot;7.5&quot; markerUnits=&quot;userSpaceOnUse&quot; markerWidth=&quot;12&quot; markerHeight=&quot;12&quot; orient=&quot;auto&quot;&gt;&lt;path d=&quot;M 1,1 L 14,14 M 1,14 L 14,1&quot; class=&quot;arrowMarkerPath&quot; style=&quot;stroke-width: 2.5;&quot; /&gt;&lt;/marker&gt;&lt;marker id=&quot;mermaid-2eb12da36bc43bdc-light-0_flowchart-v2-crossStart-margin&quot; class=&quot;marker cross flowchart-v2&quot; viewBox=&quot;0 0 15 15&quot; refX=&quot;-3.5&quot; refY=&quot;7.5&quot; markerUnits=&quot;userSpaceOnUse&quot; markerWidth=&quot;12&quot; markerHeight=&quot;12&quot; orient=&quot;auto&quot;&gt;&lt;path d=&quot;M 1,1 L 14,14 M 1,14 L 14,1&quot; class=&quot;arrowMarkerPath&quot; style=&quot;stroke-width: 2.5; stroke-dasharray: 1, 0;&quot; /&gt;&lt;/marker&gt;&lt;g class=&quot;root&quot;&gt;&lt;g class=&quot;clusters&quot; /&gt;&lt;g class=&quot;edgePaths&quot;&gt;&lt;path d=&quot;M126,86.406L130.167,86.406C134.333,86.406,142.667,86.406,150.333,86.406C158,86.406,165,86.406,168.5,86.406L172,86.406&quot; id=&quot;mermaid-2eb12da36bc43bdc-light-0-L_A_B_0&quot; class=&quot;edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link&quot; style=&quot;;&quot; data-edge=&quot;true&quot; data-et=&quot;edge&quot; data-id=&quot;L_A_B_0&quot; data-points=&quot;W3sieCI6MTI2LCJ5Ijo4Ni40MDYyNX0seyJ4IjoxNTEsInkiOjg2LjQwNjI1fSx7IngiOjE3NiwieSI6ODYuNDA2MjV9XQ==&quot; data-look=&quot;classic&quot; marker-end=&quot;url(#mermaid-2eb12da36bc43bdc-light-0_flowchart-v2-pointEnd)&quot; /&gt;&lt;path d=&quot;M307.465,61.059L317.356,56.333C327.247,51.608,347.03,42.157,361.925,37.989C376.821,33.821,386.829,34.935,391.833,35.492L396.837,36.049&quot; id=&quot;mermaid-2eb12da36bc43bdc-light-0-L_B_C_0&quot; class=&quot;edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link&quot; style=&quot;;&quot; data-edge=&quot;true&quot; data-et=&quot;edge&quot; data-id=&quot;L_B_C_0&quot; data-points=&quot;W3sieCI6MzA3LjQ2NDc3NDI3OTM4MTgsInkiOjYxLjA1ODUyNDI3OTM4MTc3fSx7IngiOjM2Ni44MTI1LCJ5IjozMi43MDYyNDkyMzcwNjA1NX0seyJ4Ijo0MDAuODEyNSwieSI6MzYuNDkxNjU4ODg5MTM2ODY1fV0=&quot; data-look=&quot;classic&quot; marker-end=&quot;url(#mermaid-2eb12da36bc43bdc-light-0_flowchart-v2-pointEnd)&quot; /&gt;&lt;path d=&quot;M401.435,76.906L395.665,78.49C389.894,80.073,378.353,83.24,367.583,84.823C356.813,86.406,346.813,86.406,341.813,86.406L336.813,86.406&quot; id=&quot;mermaid-2eb12da36bc43bdc-light-0-L_C_B_0&quot; class=&quot;edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link&quot; style=&quot;;&quot; data-edge=&quot;true&quot; data-et=&quot;edge&quot; data-id=&quot;L_C_B_0&quot; data-points=&quot;W3sieCI6NDAxLjQzNDk2MzMxMzc0NzYsInkiOjc2LjkwNjI1fSx7IngiOjM2Ni44MTI1LCJ5Ijo4Ni40MDYyNX0seyJ4IjozMzIuODEyNSwieSI6ODYuNDA2MjV9XQ==&quot; data-look=&quot;classic&quot; marker-end=&quot;url(#mermaid-2eb12da36bc43bdc-light-0_flowchart-v2-pointEnd)&quot; /&gt;&lt;path d=&quot;M302.936,116.282L313.582,122.836C324.228,129.39,345.52,142.498,367.703,149.052C389.885,155.606,412.958,155.606,424.495,155.606L436.031,155.606&quot; id=&quot;mermaid-2eb12da36bc43bdc-light-0-L_B_D_0&quot; class=&quot;edge-thickness-normal edge-pattern-solid edge-thickness-normal edge-pattern-solid flowchart-link&quot; style=&quot;;&quot; data-edge=&quot;true&quot; data-et=&quot;edge&quot; data-id=&quot;L_B_D_0&quot; data-points=&quot;W3sieCI6MzAyLjkzNjI1NjU1MDA4ODcsInkiOjExNi4yODI0OTM0NDk5MTEzMX0seyJ4IjozNjYuODEyNSwieSI6MTU1LjYwNjI1MDc2MjkzOTQ1fSx7IngiOjQ0MC4wMzEyNSwieSI6MTU1LjYwNjI1MDc2MjkzOTQ1fV0=&quot; data-look=&quot;classic&quot; marker-end=&quot;url(#mermaid-2eb12da36bc43bdc-light-0_flowchart-v2-pointEnd)&quot; /&gt;&lt;/g&gt;&lt;g class=&quot;edgeLabels&quot;&gt;&lt;g class=&quot;edgeLabel&quot;&gt;&lt;g class=&quot;label&quot; data-id=&quot;L_A_B_0&quot; transform=&quot;translate(0, 0)&quot;&gt;&lt;text y=&quot;-10.1&quot; text-anchor=&quot;middle&quot;&gt;&lt;tspan class=&quot;text-outer-tspan row&quot; x=&quot;0&quot; y=&quot;-0.1em&quot; dy=&quot;1.1em&quot; text-anchor=&quot;middle&quot; /&gt;&lt;/text&gt;&lt;/g&gt;&lt;/g&gt;&lt;g&gt;&lt;rect class=&quot;background&quot; style=&quot;stroke: none&quot; /&gt;&lt;/g&gt;&lt;g class=&quot;edgeLabel&quot; transform=&quot;translate(352.57286, 39.50897)&quot;&gt;&lt;g class=&quot;label&quot; data-id=&quot;L_B_C_0&quot; transform=&quot;translate(0, -9.000000953674316)&quot;&gt;&lt;g&gt;&lt;rect class=&quot;background&quot; style=&quot;&quot; x=&quot;-9&quot; y=&quot;-1.9999990463256836&quot; width=&quot;18&quot; height=&quot;22&quot; /&gt;&lt;text y=&quot;-10.1&quot; text-anchor=&quot;middle&quot; style=&quot;&quot;&gt;&lt;tspan class=&quot;text-outer-tspan row&quot; x=&quot;0&quot; y=&quot;-0.1em&quot; dy=&quot;1.1em&quot; text-anchor=&quot;middle&quot;&gt;&lt;tspan font-style=&quot;normal&quot; class=&quot;text-inner-tspan&quot; font-weight=&quot;normal&quot;&gt;是&lt;/tspan&gt;&lt;/tspan&gt;&lt;/text&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class=&quot;edgeLabel&quot;&gt;&lt;g class=&quot;label&quot; data-id=&quot;L_C_B_0&quot; transform=&quot;translate(0, 0)&quot;&gt;&lt;text y=&quot;-10.1&quot; text-anchor=&quot;middle&quot;&gt;&lt;tspan class=&quot;text-outer-tspan row&quot; x=&quot;0&quot; y=&quot;-0.1em&quot; dy=&quot;1.1em&quot; text-anchor=&quot;middle&quot; /&gt;&lt;/text&gt;&lt;/g&gt;&lt;/g&gt;&lt;g&gt;&lt;rect class=&quot;background&quot; style=&quot;stroke: none&quot; /&gt;&lt;/g&gt;&lt;g class=&quot;edgeLabel&quot; transform=&quot;translate(366.8125, 155.60625076293945)&quot;&gt;&lt;g class=&quot;label&quot; data-id=&quot;L_B_D_0&quot; transform=&quot;translate(0, -9.000000953674316)&quot;&gt;&lt;g&gt;&lt;rect class=&quot;background&quot; style=&quot;&quot; x=&quot;-9&quot; y=&quot;-1.9999990463256836&quot; width=&quot;18&quot; height=&quot;22&quot; /&gt;&lt;text y=&quot;-10.1&quot; text-anchor=&quot;middle&quot; style=&quot;&quot;&gt;&lt;tspan class=&quot;text-outer-tspan row&quot; x=&quot;0&quot; y=&quot;-0.1em&quot; dy=&quot;1.1em&quot; text-anchor=&quot;middle&quot;&gt;&lt;tspan font-style=&quot;normal&quot; class=&quot;text-inner-tspan&quot; font-weight=&quot;normal&quot;&gt;否&lt;/tspan&gt;&lt;/tspan&gt;&lt;/text&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class=&quot;nodes&quot;&gt;&lt;g class=&quot;node default&quot; id=&quot;mermaid-2eb12da36bc43bdc-light-0-flowchart-A-0&quot; data-look=&quot;classic&quot; transform=&quot;translate(67, 86.40625)&quot;&gt;&lt;rect class=&quot;basic label-container&quot; style=&quot;&quot; x=&quot;-59&quot; y=&quot;-21&quot; width=&quot;118&quot; height=&quot;42&quot; /&gt;&lt;g class=&quot;label&quot; style=&quot;&quot; transform=&quot;translate(0, -9)&quot;&gt;&lt;rect /&gt;&lt;g&gt;&lt;rect class=&quot;background&quot; style=&quot;stroke: none&quot; /&gt;&lt;text y=&quot;-10.1&quot; style=&quot;&quot;&gt;&lt;tspan class=&quot;text-outer-tspan row&quot; x=&quot;0&quot; y=&quot;-0.1em&quot; dy=&quot;1.1em&quot;&gt;&lt;tspan font-style=&quot;normal&quot; class=&quot;text-inner-tspan&quot; font-weight=&quot;normal&quot;&gt;读入&lt;/tspan&gt;&lt;tspan font-style=&quot;normal&quot; class=&quot;text-inner-tspan&quot; font-weight=&quot;normal&quot;&gt; h[i]&lt;/tspan&gt;&lt;/tspan&gt;&lt;/text&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class=&quot;node default&quot; id=&quot;mermaid-2eb12da36bc43bdc-light-0-flowchart-B-1&quot; data-look=&quot;classic&quot; transform=&quot;translate(254.40625, 86.40625)&quot;&gt;&lt;polygon points=&quot;78.40625,0 156.8125,-78.40625 78.40625,-156.8125 0,-78.40625&quot; class=&quot;label-container&quot; transform=&quot;translate(-77.90625, 78.40625)&quot; /&gt;&lt;g class=&quot;label&quot; style=&quot;&quot; transform=&quot;translate(0, -9)&quot;&gt;&lt;rect /&gt;&lt;g&gt;&lt;rect class=&quot;background&quot; style=&quot;stroke: none&quot; /&gt;&lt;text y=&quot;-10.1&quot; style=&quot;&quot;&gt;&lt;tspan class=&quot;text-outer-tspan row&quot; x=&quot;0&quot; y=&quot;-0.1em&quot; dy=&quot;1.1em&quot;&gt;&lt;tspan font-style=&quot;normal&quot; class=&quot;text-inner-tspan&quot; font-weight=&quot;normal&quot;&gt;栈顶高度&lt;/tspan&gt;&lt;tspan font-style=&quot;normal&quot; class=&quot;text-inner-tspan&quot; font-weight=&quot;normal&quot;&gt; h[i]&lt;/tspan&gt;&lt;tspan font-style=&quot;normal&quot; class=&quot;text-inner-tspan&quot; font-weight=&quot;normal&quot;&gt; ?&lt;/tspan&gt;&lt;/tspan&gt;&lt;/text&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class=&quot;node default&quot; id=&quot;mermaid-2eb12da36bc43bdc-light-0-flowchart-C-3&quot; data-look=&quot;classic&quot; transform=&quot;translate(506.03125, 48.20624923706055)&quot;&gt;&lt;rect class=&quot;basic label-container&quot; style=&quot;&quot; x=&quot;-105.21875&quot; y=&quot;-28.700000762939453&quot; width=&quot;210.4375&quot; height=&quot;57.400001525878906&quot; /&gt;&lt;g class=&quot;label&quot; style=&quot;&quot; transform=&quot;translate(0, -16.700000762939453)&quot;&gt;&lt;rect /&gt;&lt;g&gt;&lt;rect class=&quot;background&quot; style=&quot;stroke: none&quot; /&gt;&lt;text y=&quot;-10.1&quot; style=&quot;&quot;&gt;&lt;tspan class=&quot;text-outer-tspan row&quot; x=&quot;0&quot; y=&quot;-0.1em&quot; dy=&quot;1.1em&quot;&gt;&lt;tspan font-style=&quot;normal&quot; class=&quot;text-inner-tspan&quot; font-weight=&quot;normal&quot;&gt;弹出栈顶&lt;/tspan&gt;&lt;tspan font-style=&quot;normal&quot; class=&quot;text-inner-tspan&quot; font-weight=&quot;normal&quot;&gt; j&lt;/tspan&gt;&lt;/tspan&gt;&lt;tspan class=&quot;text-outer-tspan row&quot; x=&quot;0&quot; y=&quot;1em&quot; dy=&quot;1.1em&quot;&gt;&lt;tspan font-style=&quot;normal&quot; class=&quot;text-inner-tspan&quot; font-weight=&quot;normal&quot;&gt;此时&lt;/tspan&gt;&lt;tspan font-style=&quot;normal&quot; class=&quot;text-inner-tspan&quot; font-weight=&quot;normal&quot;&gt; i&lt;/tspan&gt;&lt;tspan font-style=&quot;normal&quot; class=&quot;text-inner-tspan&quot; font-weight=&quot;normal&quot;&gt; 就是&lt;/tspan&gt;&lt;tspan font-style=&quot;normal&quot; class=&quot;text-inner-tspan&quot; font-weight=&quot;normal&quot;&gt; j&lt;/tspan&gt;&lt;tspan font-style=&quot;normal&quot; class=&quot;text-inner-tspan&quot; font-weight=&quot;normal&quot;&gt; 的右边界&lt;/tspan&gt;&lt;/tspan&gt;&lt;/text&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;g class=&quot;node default&quot; id=&quot;mermaid-2eb12da36bc43bdc-light-0-flowchart-D-7&quot; data-look=&quot;classic&quot; transform=&quot;translate(506.03125, 155.60625076293945)&quot;&gt;&lt;rect class=&quot;basic label-container&quot; style=&quot;&quot; x=&quot;-66&quot; y=&quot;-28.700000762939453&quot; width=&quot;132&quot; height=&quot;57.400001525878906&quot; /&gt;&lt;g class=&quot;label&quot; style=&quot;&quot; transform=&quot;translate(0, -16.700000762939453)&quot;&gt;&lt;rect /&gt;&lt;g&gt;&lt;rect class=&quot;background&quot; style=&quot;stroke: none&quot; /&gt;&lt;text y=&quot;-10.1&quot; style=&quot;&quot;&gt;&lt;tspan class=&quot;text-outer-tspan row&quot; x=&quot;0&quot; y=&quot;-0.1em&quot; dy=&quot;1.1em&quot;&gt;&lt;tspan font-style=&quot;normal&quot; class=&quot;text-inner-tspan&quot; font-weight=&quot;normal&quot;&gt;栈顶即左边界&lt;/tspan&gt;&lt;/tspan&gt;&lt;tspan class=&quot;text-outer-tspan row&quot; x=&quot;0&quot; y=&quot;1em&quot; dy=&quot;1.1em&quot;&gt;&lt;tspan font-style=&quot;normal&quot; class=&quot;text-inner-tspan&quot; font-weight=&quot;normal&quot;&gt;i&lt;/tspan&gt;&lt;tspan font-style=&quot;normal&quot; class=&quot;text-inner-tspan&quot; font-weight=&quot;normal&quot;&gt; 入栈&lt;/tspan&gt;&lt;/tspan&gt;&lt;/text&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;defs&gt;&lt;filter id=&quot;mermaid-2eb12da36bc43bdc-light-0-drop-shadow&quot; height=&quot;130%&quot; width=&quot;130%&quot;&gt;&lt;feDropShadow dx=&quot;4&quot; dy=&quot;4&quot; stdDeviation=&quot;0&quot; flood-opacity=&quot;0.06&quot; flood-color=&quot;#000000&quot; /&gt;&lt;/filter&gt;&lt;/defs&gt;&lt;defs&gt;&lt;filter id=&quot;mermaid-2eb12da36bc43bdc-light-0-drop-shadow-small&quot; height=&quot;150%&quot; width=&quot;150%&quot;&gt;&lt;feDropShadow dx=&quot;2&quot; dy=&quot;2&quot; stdDeviation=&quot;0&quot; flood-opacity=&quot;0.06&quot; flood-color=&quot;#000000&quot; /&gt;&lt;/filter&gt;&lt;/defs&gt;&lt;linearGradient id=&quot;mermaid-2eb12da36bc43bdc-light-0-gradient&quot; gradientUnits=&quot;objectBoundingBox&quot; x1=&quot;0%&quot; y1=&quot;0%&quot; x2=&quot;100%&quot; y2=&quot;0%&quot;&gt;&lt;stop offset=&quot;0%&quot; stop-color=&quot;#6b6153&quot; stop-opacity=&quot;1&quot; /&gt;&lt;stop offset=&quot;100%&quot; stop-color=&quot;#3f6b5f&quot; stop-opacity=&quot;1&quot; /&gt;&lt;/linearGradient&gt;&lt;/svg&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;figcaption&gt;单调栈的入栈与出栈&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;对每个位置 &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;i&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;当栈非空且 &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;h&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;[&lt;/mo&gt;&lt;mtext&gt;栈顶&lt;/mtext&gt;&lt;mo stretchy=&quot;false&quot;&gt;]&lt;/mo&gt;&lt;mo&gt;≥&lt;/mo&gt;&lt;msub&gt;&lt;mi&gt;h&lt;/mi&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;/msub&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;h[\text{栈顶}] \ge h_i&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; 时，弹出栈顶 &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;j&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;j&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;。此时 &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;i&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; 就是 &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;j&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;j&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; 的&lt;strong&gt;右边界&lt;/strong&gt;（第一个更小的位置）。&lt;/li&gt;
&lt;li&gt;弹完后若栈还非空，栈顶就是 &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;j&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;j&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; 的&lt;strong&gt;左边界&lt;/strong&gt;；若栈空，说明 &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;j&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;j&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; 左边没有更小的，&lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mi&gt;L&lt;/mi&gt;&lt;mi&gt;j&lt;/mi&gt;&lt;/msub&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;L_j = -1&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;。&lt;/li&gt;
&lt;li&gt;把 &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;i&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; 入栈。&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;每个下标最多入栈一次、出栈一次，所以总复杂度是 &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;O&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;n&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;O(n)&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;。&lt;/p&gt;
&lt;aside class=&quot;callout&quot; data-callout=&quot;warning&quot;&gt;&lt;p class=&quot;callout-title&quot;&gt;警告&lt;/p&gt;&lt;div class=&quot;callout-body&quot;&gt;&lt;p&gt;上面用 &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mo&gt;≥&lt;/mo&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;\ge&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; 而不是 &lt;code&gt;&amp;gt;&lt;/code&gt;，对应的是“严格更小”的定义。如果题目允许相等的柱子也算边界，就要改成 &lt;code&gt;&amp;gt;&lt;/code&gt;，两种写法的答案在有重复高度时会不同。&lt;/p&gt;&lt;/div&gt;&lt;/aside&gt;
&lt;h2 id=&quot;复杂度&quot;&gt;复杂度&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;时间：&lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;O&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;n&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;O(n)&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;，每个元素进出栈各一次。&lt;/li&gt;
&lt;li&gt;空间：&lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;O&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;n&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;O(n)&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;。&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;什么时候想到它&quot;&gt;什么时候想到它&lt;/h2&gt;
&lt;p&gt;经验上，当题目出现下面这些信号时，可以往单调栈上想：&lt;/p&gt;
&lt;table tabindex=&quot;0&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;信号&lt;/th&gt;
&lt;th&gt;例子&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;求“每个位置左右第一个更大/更小的元素”&lt;/td&gt;
&lt;td&gt;每日温度、柱状图最大矩形&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;需要 O(n) 求出所有区间的最优值&lt;/td&gt;
&lt;td&gt;接雨水、跳跃游戏 II&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;括号匹配、滑动窗口最值&lt;/td&gt;
&lt;td&gt;表达式求值&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;关键词是 &lt;strong&gt;“第一个”&lt;/strong&gt; 和 &lt;strong&gt;“连续区间”&lt;/strong&gt;。如果题目问的是“任意区间”，那多半该往线段树或 ST 表上想。&lt;/p&gt;
</content:encoded><dc:creator>chaos</dc:creator><category>单调栈</category><category>数据结构</category><category>线性扫描</category></item><item><title>「洛谷 P1002」过河卒</title><link>https://io.chaos-ljc.top/posts/p1002-guo-he-zu/</link><guid isPermaLink="true">https://io.chaos-ljc.top/posts/p1002-guo-he-zu/</guid><description>棋盘上的路径计数：从状态设计到空间压缩，一步一步把暴力 DP 推到 O(nm)。</description><pubDate>Sun, 18 Oct 2026 01:00:00 GMT</pubDate><content:encoded>&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;题目&lt;/strong&gt;：洛谷 &lt;a href=&quot;https://www.luogu.com.cn/problem/P1002&quot; class=&quot;link-external&quot; rel=&quot;noopener&quot;&gt;P1002 过河卒&lt;/a&gt; · 普及-&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;时空限制&lt;/strong&gt;：1s / 128MB&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;h2 id=&quot;题意&quot;&gt;题意&lt;/h2&gt;
&lt;p&gt;给定一个 &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;mo&gt;×&lt;/mo&gt;&lt;mi&gt;B&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;A \times B&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; 的棋盘，棋子从左下角出发走到右上角，只能向右或向上走，每一步走一格。棋盘上有若干个“卒”的位置不能经过，求路径总数。&lt;/p&gt;
&lt;p&gt;数据范围：&lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mo&gt;≤&lt;/mo&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;mo separator=&quot;true&quot;&gt;,&lt;/mo&gt;&lt;mi&gt;B&lt;/mi&gt;&lt;mo&gt;≤&lt;/mo&gt;&lt;mn&gt;400&lt;/mn&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;1 \le A, B \le 400&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;，&lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;mo&gt;≤&lt;/mo&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;0 \le&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; 障碍数 &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mo&gt;≤&lt;/mo&gt;&lt;mn&gt;200&lt;/mn&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;\le 200&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;。&lt;/p&gt;
&lt;h2 id=&quot;思路&quot;&gt;思路&lt;/h2&gt;
&lt;h3 id=&quot;1-先想清楚状态&quot;&gt;1. 先想清楚状态&lt;/h3&gt;
&lt;p&gt;从下往上、从左往右推格子。设 &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;f&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;[&lt;/mo&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;]&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;[&lt;/mo&gt;&lt;mi&gt;j&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;f[i][j]&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; 表示&lt;strong&gt;从起点走到 &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;mo separator=&quot;true&quot;&gt;,&lt;/mo&gt;&lt;mi&gt;j&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;(i,j)&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; 的方案数&lt;/strong&gt;，那么：&lt;/p&gt;
&lt;div class=&quot;math-display&quot; tabindex=&quot;0&quot;&gt;&lt;span class=&quot;katex-display&quot;&gt;&lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;f&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;[&lt;/mo&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;]&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;[&lt;/mo&gt;&lt;mi&gt;j&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;]&lt;/mo&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mi&gt;f&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;[&lt;/mo&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mo stretchy=&quot;false&quot;&gt;]&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;[&lt;/mo&gt;&lt;mi&gt;j&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;]&lt;/mo&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;f&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;[&lt;/mo&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;]&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;[&lt;/mo&gt;&lt;mi&gt;j&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mo stretchy=&quot;false&quot;&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;f[i][j] = f[i-1][j] + f[i][j-1]&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;其中越界位置视为 &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;0&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;。障碍点的 &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;f&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;f&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; 值为 &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;0&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;。&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;关键在于“到达”而不是“出发”：把状态定义成“到达某点的方案数”，转移就天然是“从左边或下面走来”，只需要两个邻居。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3 id=&quot;2-处理障碍&quot;&gt;2. 处理障碍&lt;/h3&gt;
&lt;p&gt;障碍点不能被走到，所以直接令 &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;f&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;[&lt;/mo&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;]&lt;/mo&gt;&lt;mo stretchy=&quot;false&quot;&gt;[&lt;/mo&gt;&lt;mi&gt;j&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;]&lt;/mo&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;f[i][j] = 0&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;。注意不要写成“跳过这个点”——跳过意味着还能从别处到达它，语义就错了。&lt;/p&gt;
&lt;h3 id=&quot;3-空间压缩&quot;&gt;3. 空间压缩&lt;/h3&gt;
&lt;p&gt;转移只依赖上一行和当前行的左边，可以滚动成一维数组：&lt;/p&gt;
&lt;div class=&quot;math-display&quot; tabindex=&quot;0&quot;&gt;&lt;span class=&quot;katex-display&quot;&gt;&lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;f&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;[&lt;/mo&gt;&lt;mi&gt;j&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;]&lt;/mo&gt;&lt;mo&gt;←&lt;/mo&gt;&lt;mi&gt;f&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;[&lt;/mo&gt;&lt;mi&gt;j&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;]&lt;/mo&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;f&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;[&lt;/mo&gt;&lt;mi&gt;j&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mo stretchy=&quot;false&quot;&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;f[j] \leftarrow f[j] + f[j-1]&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;注意&lt;strong&gt;更新顺序&lt;/strong&gt;：&lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;j&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;j&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; 必须从小到大枚举，这样 &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;f&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;[&lt;/mo&gt;&lt;mi&gt;j&lt;/mi&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mo stretchy=&quot;false&quot;&gt;]&lt;/mo&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;f[j-1]&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; 才是当前行已经更新过的值。写反成从大到小，就会退化成“同一条路走两遍”。&lt;/p&gt;
&lt;h2 id=&quot;复杂度&quot;&gt;复杂度&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;时间：&lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;O&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;mi&gt;B&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;O(AB)&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;空间：&lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;O&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;B&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;O(B)&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;（滚动数组）&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;代码&quot;&gt;代码&lt;/h2&gt;
&lt;div class=&quot;expressive-code&quot;&gt;&lt;figure class=&quot;frame has-title&quot;&gt;&lt;figcaption class=&quot;header&quot;&gt;&lt;span class=&quot;title&quot;&gt;P1002.cpp&lt;/span&gt;&lt;/figcaption&gt;&lt;pre data-language=&quot;cpp&quot;&gt;&lt;code&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;#&lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;include&lt;/span&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;--0:#68640C;--1:#B8BB26&quot;&gt;bits/stdc++.h&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#9D0006;--1:#FB5D4A&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt;namespace&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;std&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;main&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;ios&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;sync_with_stdio&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;cin&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;tie&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;nullptr&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;a&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;b&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;cin&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;a&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;b&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#6A5F54;--0fs:italic;--1:#9D9082;--1fs:italic&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#6A5F54;--0fs:italic;--1:#9D9082;--1fs:italic&quot;&gt;// 障碍点：读到 (x, y) 表示第 x 行第 y 列&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;m&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;cin&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;m&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;vector&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;vector&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt;bool&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;blocked&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;a&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;vector&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt;bool&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;&amp;gt;(&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;b&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;));&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#9D0006;--1:#FB5D4A&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;m&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;++&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;y&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;cin&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;y&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;blocked&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;][&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;y&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#6A5F54;--0fs:italic;--1:#9D9082;--1fs:italic&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#6A5F54;--0fs:italic;--1:#9D9082;--1fs:italic&quot;&gt;// 起点在左下角 (a, 1)，终点在右上角 (1, b)，这里按“到达”倒推&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;vector&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#85570F;--1:#FABD2F&quot;&gt;dp&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;b&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;);&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#9D0006;--1:#FB5D4A&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;a&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;&amp;gt;=&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;--&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;--0:#9D0006;--1:#FB5D4A&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#AE3A03;--1:#FE8019&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;j&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;j&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;&amp;lt;=&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;b&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;++&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;j&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;            &lt;/span&gt;&lt;span style=&quot;--0:#9D0006;--1:#FB5D4A&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;blocked&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;][&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;j&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;])&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;                &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;dp&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;j&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;            &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#9D0006;--1:#FB5D4A&quot;&gt;else&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#9D0006;--1:#FB5D4A&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;a&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#9D0006;--1:#FB5D4A&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;j&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;                &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;dp&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;j&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;            &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#9D0006;--1:#FB5D4A&quot;&gt;else&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;                &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;dp&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;j&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;dp&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;j&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;dp&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;j&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;])&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;100003&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;            &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;cout&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;dp&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--0:#076678;--1:#83A598&quot;&gt;b&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#396B4C;--1:#8EC07C&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;&apos;&lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;&apos;&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#9D0006;--1:#FB5D4A&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;--0:#3C3836;--1:#EBDBB2&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#8F3F71;--1:#D3869B&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#6B5F56;--1:#A89984&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;</content:encoded><dc:creator>chaos</dc:creator><category>洛谷</category><category>P1002</category><category>动态规划</category><category>路径计数</category></item></channel></rss>