MCPcopy Create free account

hub / github.com/EndlessCheng/codeforces-go / functions

Functions8,098 in github.com/EndlessCheng/codeforces-go

Methodadd
(b matrix)
copypasta/math_matrix.go:134
Methodadd
(b Int)
copypasta/big.go:20
Methodadd
(b rat)
copypasta/big.go:40
Methodadd
(begin, end int, val int64)
copypasta/odt.go:61
FunctionaddNegabinary
负二进制数相加 LC1073/周赛139C https://leetcode-cn.com/problems/adding-two-negabinary-numbers/ https://leetcode-cn.com/contest/weekly-contest-139/
copypasta/misc.go:521
FunctionaddNegabinary
(a1, a2 []int)
leetcode/weekly/139/c/c.go:3
FunctionaddRungs
github.com/EndlessCheng/codeforces-go
leetcode/weekly/250/b/b.go:4
FunctionaddSpaces
Go 模拟 github.com/EndlessCheng/codeforces-go
leetcode/weekly/272/b/b.go:6
FunctionaddSpaces2
github.com/EndlessCheng/codeforces-go
leetcode/weekly/272/b/b.go:17
Methodadds
(b Int)
copypasta/big.go:11
Methodadds
(b rat)
copypasta/big.go:32
Methodadds
(b vec)
copypasta/geometry.go:183
FunctionalertNames
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/36/b/b.go:9
FunctionallCellsDistOrder
github.com/EndlessCheng/codeforces-go
leetcode/weekly/133/b/b.go:6
FunctionangleClock
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/19/c/c.go:6
MethodangleTo
两向量夹角 det = |A||B|sinθ dot = |A||B|cosθ => tanθ = det / dot b 在 a 左侧时返回正值 b 在 a 右侧时返回负值
copypasta/geometry.go:229
FunctionareAlmostEqual
github.com/EndlessCheng/codeforces-go
leetcode/weekly/232/a/a.go:4
FunctionareConnected
(n int, threshold int, queries [][]int)
leetcode/weekly/211/d/d.go:22
FunctionareNumbersAscending
Go 模拟 github.com/EndlessCheng/codeforces-go
leetcode/weekly/263/a/a.go:12
FunctionareOccurrencesEqual
模拟 github.com/EndlessCheng/codeforces-go
leetcode/biweekly/57/a/a.go:6
Functionarrange
github.com/EndlessCheng/codeforces-go
misc/nowcoder/6916/b/b.go:4
FunctionarrangeWords
(text string)
leetcode/weekly/189/b/b.go:8
FunctionarrayRankTransform
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/18/a/a.go:6
FunctionarraySign
github.com/EndlessCheng/codeforces-go
leetcode/weekly/236/a/a.go:4
FunctionarrayStringsAreEqual
github.com/EndlessCheng/codeforces-go
leetcode/weekly/216/a/a.go:6
FunctionarraysIntersection
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/10/a/a.go:4
FunctionassignBikes
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/1/c/c.go:4
FunctionassignTasks
(servers, tasks []int)
leetcode/weekly/243/c/c.go:17
FunctionatMostNGivenDigitSet
github.com/EndlessCheng/codeforces-go
leetcode/weekly/101/c/c.go:6
Methodatan
()
copypasta/math_ntt.go:481
Functionaverage
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/29/a/a.go:6
FunctionavoidFlood
(a []int)
leetcode/weekly/194/c/c.go:91
FunctionbalanceBST
(root *TreeNode)
leetcode/weekly/180/c/c.go:25
FunctionbalancedString
(s string)
leetcode/weekly/159/c/c.go:5
FunctionbaseNeg2
(n int)
leetcode/weekly/130/b/b.go:3
FunctionbeautySum
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/47/c/c.go:4
FunctionbeforeAndAfterPuzzles
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/8/b/b.go:9
FunctionbestCoordinate
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/37/b/b.go:9
FunctionbestTeamScore
github.com/EndlessCheng/codeforces-go
leetcode/weekly/211/c/c.go:6
Methodbfs
(n, st int, g [][]int)
copypasta/graph.go:296
Methodbfs01
01 最短路 https://oi-wiki.org/graph/bfs/#bfs_3 https://codeforces.com/blog/entry/22276 EXTRA: 1-2 最短路 https://codeforces.com/blog/entry/90917 例题: https:/
copypasta/graph.go:1196
Methodbin
30 for 1e9, 63 for int64, or bits.Len(MAX_VAL)
copypasta/trie01.go:30
MethodbinarySearch
如果维护的数据(或者判断条件)具有单调性,我们就可以在线段树上二分 未找到时返回 n+1 o=1 [l,r] 1<=l<=r<=n https://codeforces.com/problemset/problem/1179/C
copypasta/segment_tree.go:245
MethodbipartiteFindOddLengthCycle
寻找二分图中的奇环(无奇环是该图为二分图的充要条件 https://www.zhihu.com/question/52978925) https://algs4.cs.princeton.edu/code/edu/princeton/cs/algs4/Bipartite.java.html
copypasta/graph.go:2203
FunctionbitsCollection
注:有关子集枚举的位运算技巧,见 search.go
copypasta/bits.go:316
FunctionbitwiseComplement
github.com/EndlessCheng/codeforces-go
leetcode/weekly/128/a/a.go:6
Functionbonus
(n int, leadership [][]int, operations [][]int)
leetcode/season/2019fall/e/e.go:75
MethodboruvkaMST
Boruvka's algorithm 用于求解边权互不相同的无向图的最小生成森林 https://en.wikipedia.org/wiki/Bor%C5%AFvka%27s_algorithm https://oi-wiki.org/graph/mst/#boruvka https://www.
copypasta/graph.go:1598
FunctionboxDelivering
(a [][]int, _, maxBoxes, maxWeight int)
leetcode/biweekly/41/d/d.go:33
FunctionbreakPalindrome
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/18/b/b.go:4
FunctionbuddyStrings
github.com/EndlessCheng/codeforces-go
leetcode/weekly/90/a/a.go:4
FunctionbufferIO
bufio.NewWriter 相比 fmt.Println,每减少 1e5 次 Flush 可以加速约 200ms(Codeforces/AtCoder) 对比: 405ms https://codeforces.com/contest/1603/submission/135520593 187m
copypasta/io.go:23
Methodbuild
(a []int64, o, l, r int)
copypasta/segment_tree.go:215
Methodbuild
(a []int64, l, r int)
copypasta/segment_tree.go:340
Methodbuild
(a []int64, l, r int)
copypasta/segment_tree.go:411
FunctionbuildArray
github.com/EndlessCheng/codeforces-go
leetcode/weekly/248/a/a.go:4
FunctionbuildArray
(a []int, _ int)
leetcode/weekly/188/a/a.go:3
FunctionbuildCartesianTree
(a []int)
copypasta/cartesian_tree.go:17
FunctionbuildCartesianTree2
非指针版,返回每个节点的左右儿子的编号
copypasta/cartesian_tree.go:39
MethodbuildDFA
EXTRA: AC 自动机 Aho–Corasick algorithm / Deterministic Finite Automaton (DFA) https://en.wikipedia.org/wiki/Aho%E2%80%93Corasick_algorithm https://en.wi
copypasta/trie.go:216
FunctionbuildPST
t := make([]*pstNode, 1, maxVersion+1) t[0] = buildPST(a, 1, len(a)) 或者 t := []*pstNode{buildPST(a, 1, len(a))}
copypasta/segment_tree.go:573
FunctionbuildPUF
t := make([]*pufNode, 1, maxVersion+1) t[0] = buildPUF(1, n)
copypasta/union_find.go:303
FunctionbuildSplay
(l, r int)
copypasta/splay_test.go:10
FunctionbuildTree
LC 106 从中序与后序遍历序列构造二叉树
leetcode/main.go:511
FunctionbusiestServers
(k int, starts, delta []int)
leetcode/biweekly/36/d/d.go:104
FunctionbusyStudent
(startTime []int, endTime []int, queryTime int)
leetcode/weekly/189/a/a.go:3
MethodcactusDFS
五元环 https://blog.csdn.net/weixin_30563319/article/details/96009073 https://nanti.jisuanke.com/t/A1644 拟阵 Matroid https://en.wikipedia.org/wiki/Matroid
copypasta/graph.go:4002
MethodcactusDFS2
另一种写法,基于栈
copypasta/graph.go:4045
MethodcalcCC
DFS 应用:求连通分量以及每个点所属的连通分量 (Connected Component, CC) ccIDs 的值从 1 开始
copypasta/graph.go:271
FunctioncalcEquation
LC 399 带权并查集
leetcode/main.go:1225
FunctioncalcFibonacci
a(n) = p*a(n-1) + q*a(n-2) 注意:数列从 0 开始,若题目从 1 开始则输入的 n 为 n-1 https://ac.nowcoder.com/acm/contest/9247/A m 项递推式,以及包含常数项的情况见《挑战》P201 a(n) = a(n-1) + a(n
copypasta/math_matrix.go:115
Functioncalculate
表达式计算(无括号) LC227 https://leetcode-cn.com/problems/basic-calculator-ii/
copypasta/misc.go:630
FunctioncalculateTime
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/7/a/a.go:4
FunctioncanArrange
(a []int, k int)
leetcode/weekly/195/b/b.go:3
FunctioncanBeEqual
(target []int, arr []int)
leetcode/biweekly/27/a/a.go:5
FunctioncanBeIncreasing
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/55/a/a.go:6
FunctioncanBeTypedWords
github.com/EndlessCheng/codeforces-go
leetcode/weekly/250/a/a.go:6
FunctioncanBeValid
* 全部变为左括号或右括号 首先 $s$ 长度不能为奇数,此时应直接返回 $\texttt{false}$。 然后就是用括号问题的经典技巧了:通过一个变量记录括号的平衡度。 以变左括号为例,将所有可以变化的括号变为左括号,如果这样中间还是会出现平衡度小于 $0$ 的情况,那么就返回 $\tex
leetcode/biweekly/68/c/c.go:14
FunctioncanChoose
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/46/b/b.go:4
FunctioncanConstruct
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/23/b/b.go:4
FunctioncanConvert
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/6/d/d.go:4
FunctioncanConvertString
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/32/b/b.go:4
FunctioncanDistribute
todo O(m*2^m) https://leetcode-cn.com/problems/distribute-repeating-integers/solution/om2m-c-56ms-100-by-hqztrue-qmfl/ github.com/EndlessCheng/codefor
leetcode/biweekly/39/d/d.go:6
FunctioncanDivideIntoSubsequences
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/4/d/d.go:4
FunctioncanEat
github.com/EndlessCheng/codeforces-go
leetcode/weekly/226/c/c.go:6
FunctioncanFormArray
github.com/EndlessCheng/codeforces-go
leetcode/weekly/213/a/a.go:4
FunctioncanMakeArithmeticProgression
(a []int)
leetcode/weekly/196/a/a.go:5
FunctioncanMakePaliQueries
github.com/EndlessCheng/codeforces-go
leetcode/weekly/152/c/c.go:4
FunctioncanMouseWin
github.com/EndlessCheng/codeforces-go
leetcode/weekly/224/d/d.go:4
FunctioncanReach
github.com/EndlessCheng/codeforces-go
leetcode/weekly/242/c/c.go:4
FunctioncanSeePersonsCount
* 单调栈的应用 对第 $i$ 个人来说,他能看到的人中,靠右的不能被靠左的挡住,所以这些人从左往右的高度必须是严格单调递增的。 因此可以倒序遍历 $\textit{heights}$,用单调栈来维护人的高度,将 $\textit{heights}[i]$ 压入单调栈的同时,统计栈内比他矮的人数
leetcode/biweekly/57/d/d.go:16
Functioncandy
LC 135
leetcode/main.go:679
MethodcentroidDecomposition
点分治 - 重心分解(CD, Centroid Decomposition) https://oi-wiki.org/graph/tree-divide/ todo https://zhuanlan.zhihu.com/p/359209926 https://codeforces.com/blog/
copypasta/graph_tree.go:458
FunctionchalkReplacer
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/54/b/b.go:4
FunctionchampernowneConstant
钱珀瑙恩数 Champernowne constant https://en.wikipedia.org/wiki/Champernowne_constant https://oeis.org/A033307 返回第 k 位数字 https://leetcode-cn.com/contest/esp
copypasta/misc.go:872
Functionchange
github.com/EndlessCheng/codeforces-go
misc/nowcoder/6218/a/a.go:6
Functioncheck
github.com/EndlessCheng/codeforces-go
leetcode/weekly/227/a/a.go:6
FunctioncheckAlmostEquivalent
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/65/a/a.go:4
FunctioncheckArithmeticSubarrays
github.com/EndlessCheng/codeforces-go
leetcode/weekly/212/b/b.go:6
FunctioncheckIfCanBreak
(s, t string)
leetcode/biweekly/25/c/c.go:27
← previousnext →6,401–6,500 of 8,098, ranked by callers