MCPcopy Index your code
hub / github.com/EndlessCheng/codeforces-go

github.com/EndlessCheng/codeforces-go @v1.2.0 sqlite

repository ↗ · DeepWiki ↗ · release v1.2.0 ↗
9,009 symbols 22,776 edges 5,223 files 3,641 documented · 40%
README

codeforces-go 💭💡🎈

算法 Algorithm

由于算法知识点繁杂,将自己学习到的算法、做过的题目分类整理好是有必要的。

一个算法模板应当涵盖以下几点: - 对该算法的基本介绍(核心思想、复杂度等) - 参考链接或书籍章节(讲的比较好的资料) - 模板代码(可以包含一些注释、使用说明) - 模板补充内容(常见题型中的额外代码、建模技巧等) - 相关题目链接(模板题、经典题、思维转换题等)

算法目录

如何选择题目 How to Choose Problems

Rating < 2100

这一阶段主要目标是提高对问题的观察能力。做构造题可以针对性地训练这一点。

选择难度在自己 rating 到 rating+200 范围内的构造题 (tag: constructive algorithms),按照过题人数降序做题,比如 [1700,1900] 区间的就是下面这个链接:

https://codeforces.com/problemset?order=BY_SOLVED_DESC&tags=constructive+algorithms%2C1700-1900

通过大量的构造题训练,提高观察能力,快速找到切题入口。

Rating >= 2100

这一阶段要想上分,应以 DP 为主,图论和数据结构为辅。难度范围选择同上,可以根据自己在该项的能力上下调整。

我的 Codeforces 账号:

0x3F

测试及对拍 Testing

编写一个 run(io.Reader, io.Writer) 函数来处理输入输出。这样写的理由是:

  • main 中调用 run(os.Stdin, os.Stdout) 来执行代码;
  • 测试时,将测试数据转换成 strings.Reader 当作输入,并用一个 strings.Builder 来接收输出,将这二者传入 run 中,然后就能比较输出与答案了;
  • 对拍时需要实现一个暴力算法 runAC,参数和 run 一样。通过随机数据生成器来生成数据,分别传入 runACrun,通过比对各自的输出,来检查 run 中的问题。

具体可以见 Codeforces 代码仓库 main,所有非交互题的代码及其对应测试全部按照上述框架实现。

例如:1439C_test.go

交互题的写法要复杂一些,需要把涉及输入输出的地方抽象成接口,详见 interactive_problem

学习资料及题目 Resources

注:由于入门经典上选了很多区域赛的题,一部分题目可以在 GYM 上找到,这样可以就可以用 Go 编程提交了。

算法竞赛入门经典(第二版)

算法竞赛入门经典训练指南

算法竞赛入门经典训练指南(升级版)

算法竞赛进阶指南

算法竞赛入门到进阶

OI Public Library(含国家队论文)

算法竞赛 (ICPC, OI, etc) 论文,课件,文档,笔记等

算法竞赛课件分享 by hzwer

算法第四版 Java 源码

数据结构和算法动态可视化

OI Wiki

CP-Algorithms

洛谷日报

All the good tutorials found for Competitive Programming

Codeforces Problem Topics

GeeksforGeeks 上的算法合集

Pepcy 模板

F0RE1GNERS 模板

【模板整合计划】目录

算法学习笔记(目录)

洛谷模板题(建议按难度筛选)

能力全面提升综合题单

Luogu Problem List

洛谷原试炼场

Links of ICPC/CCPC Contests from China

高级竞赛算法

算法进阶课

AtCoder 版《挑战程序设计竞赛》

AtCoder 版!蟻本 (初級編)

AtCoder 版!蟻本 (中級編)

AtCoder 版!蟻本 (上級編)

AtCoder 版!蟻本 (発展的トピック編)

待整理

【杂文】记一些有用的神奇网站

偶然在 GitHub 上发现的超长列表

算法竞赛训练中较难的部分

算法竞赛中可能不太会遇到的论文题

[杂谈]OI/ACM中冷门算法

https://blog.csdn.net/calabash_boy/article/details/79973483

https://github.com/zimpha/algorithmic-library

https://www.luogu.com.cn/blog/command-block/blog-suo-yin-zhi-ding-post

https://wcysai.github.io/

https://www.luogu.com.cn/blog/Troverld/index

其他 Others

My GoLand Live Templates and Postfix Completion settings

Useful Tools

Draw Geometry

Draw Graph

OEIS

Wolfram|Alpha

UpSolve.me

Codeforces Upsolving Helper

Contests Filter

Codeforced

Codeforces Visualizer

Codeforces Solve Tracker

Another Codeforces Solve Tracker

Rating and Difficulties

Open Codeforces Rating System

How to Interpret Contest Ratings

Codeforces: Problem Difficulties

Elo rating system

Stay Healthy

Exercises!

Extension points exported contracts — how you extend this code

OutputChecker (FuncType)
(no doc)
main/testutil/testutil.go

Core symbols most depended-on inside this repo

AssertEqualCase
called by 1340
main/testutil/testutil.go
f
called by 913
main/1600-1699/1617E.go
RunLeetCodeFuncWithExamples
called by 693
leetcode/testutil/leetcode.go
max
called by 320
main/gym/101487/D.go
AssertEqualStringCase
called by 298
main/testutil/testutil.go
min
called by 296
main/gym/101487/D.go
Int
called by 206
main/testutil/rand.go
NewLine
called by 132
main/testutil/rand.go

Shape

Function 6,356
Method 1,742
Struct 772
TypeAlias 134
FuncType 4
Interface 1

Languages

Go100%
TypeScript1%

Modules by API surface

copypasta/geometry.go95 symbols
copypasta/graph.go76 symbols
leetcode/main.go72 symbols
copypasta/segment_tree.go51 symbols
main/testutil/rand.go33 symbols
copypasta/math_ntt.go33 symbols
copypasta/bst.go33 symbols
copypasta/big.go30 symbols
copypasta/heap.go29 symbols
copypasta/graph_tree.go27 symbols
misc/luogu/p2586.go25 symbols
copypasta/red_black_tree.go25 symbols

Dependencies from manifests, versioned

github.com/blend/go-sdkv1.20211025.3 · 1×
github.com/golang/freetypev0.0.0-2017060900350 · 1×
github.com/google/go-querystringv1.0.0 · 1×
github.com/levigross/grequestsv0.0.0-2019090817411 · 1×
github.com/pmezard/go-difflibv1.0.0 · 1×
github.com/skratchdot/open-golangv0.0.0-2020011605553 · 1×
github.com/wcharczuk/go-chartv2.0.1+incompatible · 1×
golang.org/x/imagev0.0.0-2021062800285 · 1×
golang.org/x/netv0.0.0-2021091722173 · 1×

For agents

$ claude mcp add codeforces-go \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact