codeforces-go
算法竞赛模板库 by 灵茶山艾府 💭💡🎈
A personal collection of ready-to-use algorithm templates and Codeforces problem solutions in Go, covering data structures, graphs, strings, and math for competitive programmers.
This repository is a personal collection of algorithm templates and solved problems for competitive programming, written in the Go programming language. It is maintained by a Chinese programmer known as Lingcha Shanaifu, and the documentation is written entirely in Chinese. The library targets people who participate in online coding contests, particularly on platforms like Codeforces and LeetCode.
The core of the repository is a folder called copypasta, which contains ready-to-use code templates organized by algorithm category. These categories cover a very wide range: data structures like segment trees, union-find sets, and various types of heaps; string algorithms like KMP and suffix automata; graph algorithms covering shortest paths, minimum spanning trees, maximum flow, and topological sorting; and mathematical topics including number theory, combinatorics, fast Fourier transforms, and computational geometry. Each template file is a self-contained Go source file named after the algorithm it implements.
Alongside the templates, the repository contains the author's actual solutions to problems submitted on Codeforces. The directory structure mirrors Codeforces contest and problem identifiers, so each solution file corresponds to a specific contest problem. This means someone browsing the repository can look up solutions by contest number.
The README also includes a curated set of problem lists on LeetCode, grouped by topic such as sliding window, binary search, dynamic programming, and graph algorithms. These lists serve as a structured study guide for people working to improve their rating in competitive programming.
This is not a tutorial or a beginner's learning resource in the typical sense. It assumes the reader already understands competitive programming and is looking for reference implementations or solutions to check their own work against. The README is in Chinese throughout, so readers who do not read Chinese will find the documentation difficult to follow even though the code itself is in Go.
Where it fits
- Copy ready-made Go templates for segment trees, shortest paths, or suffix automata directly into your contest solution.
- Look up the author's Codeforces solutions by contest and problem number to check your own approach.
- Follow the curated LeetCode topic lists organized by algorithm type as a structured study guide for improving your rating.