Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from OI-wiki:master #17

Open
wants to merge 698 commits into
base: master
Choose a base branch
from
Open

Conversation

pull[bot]
Copy link

@pull pull bot commented Jan 28, 2023

See Commits and Changes for more details.


Created by pull[bot]

Can you help keep this open source service alive? 💖 Please sponsor : )

@pull pull bot added the ⤵️ pull label Jan 28, 2023
CodingOIer and others added 29 commits December 28, 2023 17:32
* fix(basic/complexity): 修复关于主定理的举例错误,给主定理中容易被误解部分添加括号

* feat(basic/complexity): 主定理举例以列表列出

* style: format markdown files with remark-lint

---------

Co-authored-by: 24OI-bot <[email protected]>
Update sublime.md

ChineseLocalizationgs -> ChineseLocalizations

一个不影响阅读的小错误
Update concept.md : change the order of contents.

在度数部分出现的握手定理中,提到了简单图, 因此应先介绍简单图的定义。
* 添加图论计数习题

* style: format markdown files with remark-lint

---------

Co-authored-by: 24OI-bot <[email protected]>
* Update bst.md

更新了二叉搜索树节点定义与几个函数

* Update bst.md

* style: format markdown files with remark-lint

* Update bst.md

* style: format markdown files with remark-lint

* fix(bst.md): indent

* style: format markdown files with remark-lint

* fix(bst.md): indent

* style: format markdown files with remark-lint

---------

Co-authored-by: 24OI-bot <[email protected]>
Co-authored-by: Tifa <[email protected]>
Update bfs.md

修改错误,对于判断一个点v是否在(a, b)的最短路上,应该判断da[v] + db[v] 与 da[b]是否相等。
* fix(dp/basic): 修正最长不降子序列中算法过程

第二次内容修正

* Update basic.md

* style: format markdown files with remark-lint

* Update basic.md

* Theorical Update 1

* 增加算法二的理由

* style: format markdown files with remark-lint

* Update basic.md

* Apply suggestions from code review

---------

Co-authored-by: 24OI-bot <[email protected]>
Co-authored-by: Tifa <[email protected]>
fix(ds/rbtree): 修复笔误 性质4改为性质3

Co-authored-by: Tifa <[email protected]>
Update quadrangle.md

区间合并 部分引理一证明中有误:

根据下文 $f(a,d) + f(b,c) \geq f(a,d) + f(b,c)$ 应当是 $f(a,d) + f(b,c) \geq f(a,c) + f(b,d)$

~~($f(a,d) + f(b,c) \geq f(a,d) + f(b,c)$ 好像也可以不用证明吧)~~
* feat(tools/editor/vscode.md):增加了更多编辑有关的内容,更改了C/C++扩展部分的逻辑顺序。

* style: format markdown files with remark-lint

* Update docs/tools/editor/vscode.md

Co-authored-by: Tifa <[email protected]>

---------

Co-authored-by: 24OI-bot <[email protected]>
Co-authored-by: Tifa <[email protected]>
* 重写线段树与离线询问部分

* style: format markdown files with remark-lint

* Update segment-tree-offline.md

* Update segment-tree-offline.md

* Update segment-tree-offline.md

* Update segment-tree-offline.md

* Update segment-tree-offline.md

* Update segment-tree-offline.md

* Update segment-tree-offline.md

* Update docs/topic/segment-tree-offline.md

Co-authored-by: Tifa <[email protected]>

* Update segment-tree-offline.md

* style: format markdown files with remark-lint

* fix(segment-tree-offline.md): remove extra `\n`

* fix(segment-tree-offline.md): format

* perf(segment-tree-offline.md): tiny change

* tiny changes of codes

---------

Co-authored-by: 24OI-bot <[email protected]>
Co-authored-by: Tifa <[email protected]>
* feat(graph/tree-diameter.md):增加一种树的直径新的DP求法

增加一种树的直径新的DP求法,该方法只适用一个数组进行DP。

* style: format markdown files with remark-lint

* Apply suggestions from code review

---------

Co-authored-by: 24OI-bot <[email protected]>
Co-authored-by: Tifa <[email protected]>
* Update/Create count.md

空白页面填写

* style: format markdown files with remark-lint

* fix(count.md): 修改了一些原创名词

* style: format markdown files with remark-lint

* Update count.md

* style: format markdown files with remark-lint

---------

Co-authored-by: 24OI-bot <[email protected]>
Co-authored-by: Tifa <[email protected]>
1. 在最近公共祖先的内容中,提到算法的复杂度为O(m\alpha (m+n, n)+n)那么对应的实现应该使用路径压缩,因此添加路径压缩。
2. 在tarjan函数内部已经进行parent[u] = u;操作,不需要进行额外的init,因此删除init函数及其调用。
<fix>: 更改如果用同一个值的情况下tree与heap矛盾

在val和priority同时使用一个值的情况下,treap会变成一条链,假如是大根堆,左子树的每个值小于根节点,那么整个结构就会变成一条只有左子树的链,从上到下依次减小,同样也能满足两种结构的性质,并不会产生矛盾
> $t$ 是回文串 $s$ 的 border ($|s|\le 2|t|$),$s$ 是回文串当且仅当 $t$ 是回文串。

改为

> $t$ 是串 $s$ 的 border ($|s|\le 2|t|$),$s$ 是回文串当且仅当 $t$ 是回文串。
* fix(graph/shortest-path.md): 修改Bellman-Ford实现 使其复杂度严格为O(nm)

* style: format markdown files with remark-lint

---------

Co-authored-by: 24OI-bot <[email protected]>
* fix(number-theory/sieve): 修正埃氏筛代码

* style: format markdown files with remark-lint

---------

Co-authored-by: 24OI-bot <[email protected]>
<fix>(graph/matrix-tree): 修正笔误

性质1(Laplace 矩阵所有代数余子式的值都相等)中证明中有一处笔误,交换两列移动第 k 到第 j 列,所以对符号的影响应该是 (-1)^{1+(k-1)-(**j**+1)+1} 而不是 (-1)^{1+(k-1)-(**r**+1)+1}。
because $\sqrt{d}\in\mathbb{Z}[\sqrt{d}]\setminus\mathbb{Z}$ such that $a\sqrt{d}\notin\mathbb{Z},~\forall a\in\mathbb{Z}\setminus\{0\}$
….github/workflows (#5347)

chore(deps): bump tj-actions/changed-files in /.github/workflows

Bumps [tj-actions/changed-files](https://github.com/tj-actions/changed-files) from 35.4.1 to 41.0.0.
- [Release notes](https://github.com/tj-actions/changed-files/releases)
- [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md)
- [Commits](tj-actions/changed-files@v35.4.1...v41.0.0)

---
updated-dependencies:
- dependency-name: tj-actions/changed-files
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* use remark-tabbed v0.1.0 rather than git dependency

* add lock
原文“文明”一词不知想表达什么,不太通顺.
hsiviter and others added 30 commits July 2, 2024 08:33
原 Stein 算法代码实现中最后结果计算使用了更新后的 btimes ,这使得最终结果与正确结果缺少 2 的若干个次方,因此进行修改。
* fix(math/binary-set): fix incorrect formula on counting subsets
* Update mod-shortest-path_1.cpp

初始化无穷有锅,新的代码可以过洛谷新增的 Hack 数据

* Update mod-shortest-path_1.cpp

* Update mod-shortest-path.md

在《跳楼机》题目中,新增了对 Hack 原理的说明,以及对代码的解释。

* Update mod-shortest-path.md

fix a mistake
此处公式错将`bc`写成`ba`

例如 $a=5,b=2,c=6$ 时:

$[a,b,c]=30,[ab,bc,ca]=[10,12,30]=60,[a,b][b,c][c,a]=10\times6\times30$

而

$[ab,ba,ca]=[10,10,30]=30$ 不满足相等的条件。
<fix>(<rbtree.md>): <修正红黑树 Case 6 插入的笔误>

在红黑树插入案例中 Case 6 处将 N 节点为左子节点且父节点为左子节点(LL) 情况笔误写成了  或 N 节点为左子节点且父节点为右子节点(LR)
* feat(tools/editor/codeblocks.md): 添加Code::Blocks的使用介绍 (#4621)

* style: format markdown files with remark-lint

* fix(codeblocks.md): 修改部分描述,使用detail语法 (#4621)

* fix(codeblocks.md): 添加warning语法块标题

* fix(codeblocks.md): 修改warning标题

* fix(codeblocks.md): 删除了语法块前的一个空格

* fix(codeblocks.md): 添加MinGWl两侧空格

* fix(codeblocks.md): 修复同步错误异常

* change title & remove empty list

* Clion -> CLion

---------

Co-authored-by: 24OI-bot <[email protected]>
Co-authored-by: Heran Yang <[email protected]>
Update llrbt.md

这里是不是标号错了
Update order-theory.md
* Update top-tree.md(typo)

* style: format markdown files with remark-lint

---------

Co-authored-by: 24OI-bot <[email protected]>
* feat(op-overload.md): 增加了算数运算符重载的例子和三路比较

* style: format markdown files with remark-lint

* fix(op-overload.md): 修改表述;更换三路比较信源至 cppreference

* style: format markdown files with remark-lint

* fix(op-overload.md): 修正引号使用

* fix(op-overload.md): 修正引用链接

---------

Co-authored-by: 24OI-bot <[email protected]>
* fix(dsu-on-tree.md):修缮内容

* style: format markdown files with remark-lint

* fix(dsu-on-tree.md):修缮内容

* style: format markdown files with remark-lint

---------

Co-authored-by: 24OI-bot <[email protected]>
fix(discrete.md):修改错字,将“跟据”修改为“根据”
…5732)

* fix(math/number-theory/prime.md): 修复素性测试代码;修改奇怪用语

* fix(math/number-theory/prime.md): Carmichael 数的定义

定义前后不一
# 代码片段测试技术文档

拟通过一个新的PR引入用于在OI-Wiki代码仓库中的代码片段开展测试的功能。本文档对此功能的实现、使用细节进行介绍。

## 1. 代码片段测试功能实现

目前的流程由 workflow 脚本检测发生改变的代码文件 `docs/some/path/code/topic/filename.cpp` 目录下的cpp文件。对于发生改动/新增的上述文件,scripts/test.py 脚本寻找 `docs/some/path/examples/topic/filename.in` 和 `docs/some/path/examples/topic/filename.out` 作为输入输出对,编译、运行此代码并检查输出是否符合预期。

此PR提出的新流程基于此基础之上,针对无法测试代码片段的问题进行改进,也一并完善其他功能要点。主要改动总结如下:

- **代码片段测试功能** 使用代码自身及其(具有特定命名特征的)附属文件参与编译,在支持原有的单文件测试的同时使用多文件编译的方法支持对代码片段的测试。

    现在脚本会在检测到代码文件改动时,寻找 `docs/some/path/code/topic/filename.cpp` 作为主文件,同时寻找命名形如 `docs/some/path/code/topic/filename.aux1.cpp` 作为辅助文件。并产生`gcc filename.cpp filename.aux1.cpp -o filename`的编译命令。

    对于内容创作者,在主文件中可以只保留最核心的算法和数据结构定义,而将输入输出和辅助函数等部分放在辅助文件中,在OI-Wiki网站中只展示主文件以便精简代码篇幅,同时在测试时能运行完整的代码。

  <details>
    <summary>大图预警</summary>
    <img src="https://github.com/user-attachments/assets/63de0ba4-61c1-4981-a2af-76286cf13957"/>
  </details>

    这张图中的代码是将完整代码修改为代码片段后在前端的显示结果(相关改动在 f7446be 引入)。仅略去输入输出处理,大约节省了20行空间。

    此外,OI-Wiki中也存在很多现有的无法运行无法测试的代码片段,被硬编码进md文档中。该功能的提出可允许将这些代码片段纳入到测试中。

- **多测试点支持** 修改触发测试的逻辑,扩大寻找测试点的范围,同时使测试点的改动也能引起测试。这允许增删改数据点,允许为一份代码添加多个测试点,也为接下来可能的用户提供样例功能提供便利。

    现在脚本会在原先寻找 `docs/some/path/examples/topic/filename.in` 和 `docs/some/path/examples/topic/filename.ans` 的基础上,寻找形如 `docs/some/path/examples/topic/filename.1.in` 和 `docs/some/path/examples/topic/filename.1.ans` 作为额外的输入输出对。如果有读者发现了源代码的错误,可以直接通过PR提交新测试点即可。也有计划在未来使用(另一项目开发的)划词评论功能引导读者在网站上便捷地创建PR/Issue。

- **完善log和summary** 测试结果通过GitHub Action日志和Summary的形式展示。会比之前稍微详细一点吧...也许?

## 2. 效果展示

新的脚本文件根据测试执行情况可能得到以下结果:

1. AC

    ![ACLog](https://github.com/user-attachments/assets/b68b1dc6-5ee7-49f0-b204-5fc3b5ba8e72)

    ![ACSumm](https://github.com/user-attachments/assets/8af0b4a6-8dbc-45d3-b02a-62c74fb97262)

2. WA

    ![WALog](https://github.com/user-attachments/assets/09a3f372-ea58-4c65-9675-bc8721eb0d65)

    ![WASumm](https://github.com/user-attachments/assets/0ca061b6-2918-4ad2-be19-ceff11646dce)

3. RE

    ![RELog](https://github.com/user-attachments/assets/82b46185-ddbe-43d5-a04a-bc5f4f61d398)

    ![RESumm](https://github.com/user-attachments/assets/6ff4d7c6-91ef-4153-ace9-10948495e05f)

4. CE

    ![CELog](https://github.com/user-attachments/assets/b452ada0-23fa-4a46-961b-7944af3f6a6a)

    ![CESumm](https://github.com/user-attachments/assets/11ee7d44-1b20-4e8f-a0f8-524da36e9da8)

5. No Data (成功编译,但因为没有数据所以未能进一步测试)
    
    从实际需要出发,这种情况视为通过,不会导致测试失败,但是会在GitHub Action Summary和Log中显示,并在File Changed视图中通过Annotation标记出来。审核者可以根据实际情况决定是否允许这种更改。
    
    ![NDLog](https://github.com/user-attachments/assets/84dd867d-4f54-42c0-a9bb-db6a28f4117a)

    ![NDSumm](https://github.com/user-attachments/assets/23209e5b-1779-46b2-a83f-2ccc972ad62f)

    ![NDFc](https://github.com/user-attachments/assets/5fa0270d-9076-4fd3-8644-8fe752727f34)

## 3. 可用于参考的链接

(因为这个PR就绪之后会把为了测试特殊情况引入代码的改动全删掉所以到那时Action应该会是绿的,但是跑过的Action记录是能查到的,所以在这里把链接留下)

1. GitHub Action Log. 

    https://github.com/OI-wiki/OI-wiki/actions/runs/10060883443/job/27809545688?pr=5729

2. GitHub Action Summary.

    https://github.com/OI-wiki/OI-wiki/actions/runs/10060883443?pr=5729
* feat(graph/scc): 完善了 Tarjan 算法的引入与前置的栈定义

* feat(graph/scc): 完善了 Tarjan 算法的引入与前置的栈定义,修改表达

Co-authored-by: Alphagocc <[email protected]>

---------

Co-authored-by: Alphagocc <[email protected]>
Update cartesian-tree.md

键值用w表示,而不是k,应该是笔误
* fix(ds/cartesian-tree): improve content

* style: format markdown files with remark-lint

---------

Co-authored-by: 24OI-bot <[email protected]>
* fix(docs/contest/common-mistakes.md): 删去一个错项

删去了“特别的,也不能在执行 ios::sync_with_stdio(false); 后使用
freopen。”。这并没有理论依据,且很可能是无中生有的说法。

* style: format markdown files with remark-lint

---------

Co-authored-by: 24OI-bot <[email protected]>
* feat (graph/bcc.md): 修缮内容

* style: format markdown files with remark-lint

* fix(docs\graph\examples\bcc\bcc_3.ans): 文件名错误

* fix(docs\graph\code\bcc\bcc_2.cpp): 代码错误

* fix(docs\graph\examples\bcc\bcc_3.ans): 数据错误

* fix(docs\graph\bcc.md):标题层级错误

* refactor(docs/bcc.md): 重构双连通分量的界面。

* feat(graph/bcc.md):将 DFS 算法更名为差分算法并优化描述,增加差分算法的示例代码

* feat(graph/bcc.md):增加一道边双差分算法的例题

* feat(graph/bcc.md):修正题解格式

* style: format markdown files with remark-lint

---------

Co-authored-by: 24OI-bot <[email protected]>
Co-authored-by: xglight <[email protected]>
* fix(graph/shortest-path.md):删除定义但未使用的函数参数

graph/shortest-path.md中dijkstra算法的优先队列C++实现定义了函数参数int n但并未在函数体内使用

* 优化dijkstra函数dis数组初始化

将dis数组的初始化范围改为使用的部分而不是全部

* style: format markdown files with remark-lint

* 优化最短路算法初始化

* style: format markdown files with remark-lint

---------

Co-authored-by: 24OI-bot <[email protected]>
* feat: add top tree 1

* feat: add top tree 2

* feat: top tree 3

* feat: top tree 4

* feat: top tree 5

* feat: add top tree6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment