MCPcopy Create free account

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

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

FunctiongetMaximumGenerated
github.com/EndlessCheng/codeforces-go
leetcode/weekly/214/a/a.go:4
FunctiongetMaximumXor
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/50/c/c.go:4
FunctiongetMinDistSum
github.com/EndlessCheng/codeforces-go
leetcode/weekly/197/d/d.go:9
FunctiongetMinDistance
github.com/EndlessCheng/codeforces-go
leetcode/weekly/239/a/a.go:4
FunctiongetMinSwaps
(s string, k int)
leetcode/weekly/239/c/c.go:60
FunctiongetMinimums
(a []int)
misc/nowcoder/9224/c/c.go:37
FunctiongetNoZeroIntegers
(n int)
leetcode/weekly/171/a/a.go:8
FunctiongetNumberOfBacklogOrders
(orders [][]int)
leetcode/weekly/233/b/b.go:23
FunctiongetOrder
(a [][]int)
leetcode/weekly/237/c/c.go:20
FunctiongetPermutation
LC 60 逆康托展开
leetcode/main.go:328
FunctiongetProbability
(a []int)
leetcode/weekly/191/d/d.go:3
FunctiongetProbability2
总数是可以用组合数算出来的
leetcode/weekly/191/d/d.go:48
FunctiongetScores
github.com/EndlessCheng/codeforces-go
misc/nowcoder/6489/c/c.go:4
FunctiongetSmallestString
github.com/EndlessCheng/codeforces-go
leetcode/weekly/216/b/b.go:6
FunctiongetStrongest
(a []int, k int)
leetcode/weekly/192/b/b.go:5
FunctiongetSum
(a []int, query []int)
misc/nowcoder/9476/b/b.go:7
FunctiongetSumAbsoluteDifferences
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/41/b/b.go:4
FunctiongetTriggerTime
(increase [][]int, req [][]int)
leetcode/season/2020spring/c/c.go:5
FunctiongetWinner
github.com/EndlessCheng/codeforces-go
leetcode/weekly/200/b/b.go:4
FunctiongetXORSum
github.com/EndlessCheng/codeforces-go
leetcode/weekly/237/d/d.go:4
FunctiongoodDaysToRobBank
前后缀经典技巧 github.com/EndlessCheng/codeforces-go
leetcode/biweekly/67/b/b.go:6
FunctiongoodNodes
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/26/c/c.go:6
FunctiongrayCode
格雷码 https://oeis.org/A003188 https://oeis.org/A014550 https://en.wikipedia.org/wiki/Gray_code LC89 https://leetcode-cn.com/problems/gray-code/ 转换 http
copypasta/misc.go:473
FunctiongridCollection
网格/矩阵上的搜索 NOTE: 对于 n*m 的网格图,BFS 最多只占用 O(min(n,m)) 的空间,而 DFS 最多会占用 O(nm) 的空间 易错题 https://codeforces.com/problemset/problem/540/C 思维转换 LCP31 https://le
copypasta/search.go:974
FunctiongridGame
github.com/EndlessCheng/codeforces-go
leetcode/weekly/260/b/b.go:6
FunctiongroupThePeople
(groupSizes []int)
leetcode/weekly/166/b/b.go:3
FunctionhalfQuestions
github.com/EndlessCheng/codeforces-go
leetcode/lc-vscode/b/b.go:6
FunctionhalvesAreAlike
github.com/EndlessCheng/codeforces-go
leetcode/weekly/221/a/a.go:6
FunctionhasAllCodes
(s string, k int)
leetcode/biweekly/27/b/b.go:5
FunctionhasCycle
LC 141 O(1) 判环
leetcode/main.go:741
FunctionhasValidPath
(grid [][]int)
leetcode/weekly/181/c/c.go:3
MethodheavyLightDecomposition
树链剖分/重链剖分 (HLD, Heavy Light Decomposition) 性质: 树上每个结点都属于且仅属于一条重链 如果 v-w 是一条轻边,那么 size[w] < size[v]/2 从根结点到任意结点所经过的重链数为 O(logn),轻边数为 O(logn) 与重心的关系(见 f
copypasta/graph_tree.go:1046
MethodheavyLightDecompositionByDepth
长链剖分 长链剖分和重链剖分一样,是把一棵树分成若干条不相交的链 但是,这里的重儿子不再是子树大小最大的,而是深度最大的子节点(长儿子) 根据这一定义可推出,从根结点到任意结点所经过的轻边数为 O(√n) (想象一颗长儿子不断递减的二叉树) https://oi-wiki.org/graph/hld
copypasta/graph_tree.go:1154
FunctionhighFive
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/2/b/b.go:6
FunctionhighestPeak
(g [][]int)
leetcode/biweekly/46/c/c.go:8
FunctionhitBricks
LC 803 打砖块
leetcode/main.go:1519
MethodinOutTimestamp
每个节点的入出时间戳 应用:可以 O(1) 判断 fa 是否为 v 的祖先节点(是否在根到 v 的路径上) 例题 https://codeforces.com/problemset/problem/1328/E 好题(需要充分利用入出时间戳的性质)https://codeforces.com/pro
copypasta/graph_tree.go:148
MethodinRect
判断点 a 是否在以线段 l 为对角线的矩形内(矩形与坐标轴平行)
copypasta/geometry.go:381
Functionincenter
三角形内心(三条角平分线的交点) 三点坐标按对边长度加权平均 https://en.wikipedia.org/wiki/Incenter
copypasta/geometry.go:295
FunctionincreasingBST
github.com/EndlessCheng/codeforces-go
leetcode/weekly/100/b/b.go:6
FunctionindexPairs
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/1/b/b.go:9
Functioninit
github.com/EndlessCheng/codeforces-go
main/300-399/387E.go:11
Functioninit
github.com/EndlessCheng/codeforces-go
main/900-999/979D.go:11
Functioninit
todo 目前最快做法,待研究 https://codeforces.com/contest/484/submission/100555356 github.com/EndlessCheng/codeforces-go
main/400-499/484E.go:14
Functioninit
()
misc/nowcoder/6219/c/c.go:7
Functioninit
* k-d tree: k-dimensional tree; k 维树 https://en.wikipedia.org/wiki/K-d_tree 推荐 https://www.luogu.com.cn/blog/command-block/kdt-xiao-ji https://www.lu
copypasta/kd_tree.go:20
Functioninit
()
leetcode/biweekly/2/d/d.go:24
Functioninit
()
leetcode/biweekly/50/d/d.go:8
Functioninit
()
leetcode/biweekly/46/d/d.go:8
Functioninit
()
leetcode/biweekly/44/d/d.go:9
Functioninit
()
leetcode/biweekly/30/d/d.go:6
Functioninit
()
leetcode/biweekly/56/a/a.go:8
Functioninit
()
leetcode/weekly/215/d/d.go:7
Functioninit
()
leetcode/weekly/204/d/d.go:19
Functioninit
()
leetcode/weekly/195/c/c.go:9
Functioninit
github.com/EndlessCheng/codeforces-go
leetcode/weekly/198/c/c_test.go:11
Functioninit
()
leetcode/weekly/257/d/d.go:10
Functioninit
github.com/EndlessCheng/codeforces-go
leetcode/weekly/133/d/d.go:6
Functioninit
()
leetcode/weekly/199/d/d.go:5
Functioninit
github.com/EndlessCheng/codeforces-go
leetcode/weekly/197/c/c.go:9
Functioninit
()
leetcode/weekly/62/d/d.go:5
Functioninit
()
leetcode/weekly/241/d/d.go:8
Functioninit
()
leetcode/weekly/247/d/d.go:8
FunctioninorderTraversal
LC 94 Morris 中序遍历
leetcode/main.go:455
FunctioninterchangeableRectangles
* 哈希表统计比值的最简分数 将宽高比 w/h 化简为最简分数,用哈希表统计最简分数的个数。若有 $m$ 个宽高比相同的矩形,则可互换的矩形对有 $C_m2=\dfrac{m\cdot(m-1}{2}$ 个。遍历哈希表,累加所有可互换的矩形对的个数即为答案。 */ github.com/Endl
leetcode/weekly/258/b/b.go:11
Functioninterpret
github.com/EndlessCheng/codeforces-go
leetcode/weekly/218/a/a.go:6
Methodintersection2
直线 a b 交点 - 两点式 线段求整数交点 https://codeforces.com/problemset/problem/1036/E
copypasta/geometry.go:399
MethodintersectionCircle
两圆交点 另一种写法是解二元二次方程组,精度更优
copypasta/geometry.go:507
MethodintersectionLine
直线与圆的交点
copypasta/geometry.go:487
FunctionintersectionSizeTwo
LC 757
leetcode/main.go:1501
Methodinv
NxN 矩阵求逆 模板题 https://www.luogu.com.cn/problem/P4783
copypasta/math_matrix.go:179
FunctioninvalidTransactions
(transactions []string)
leetcode/weekly/151/a/a.go:8
MethodinverseGraphComponents
反图的连通分量 O(n+m) https://www.luogu.com.cn/blog/endlesscheng/solution-cf1242b https://codeforces.com/contest/190/problem/E https://codeforces.com/contest
copypasta/graph.go:2103
FunctioninvertTree
LC 226
leetcode/main.go:994
Functionioq1174
()
main/1100-1199/1174F.go:63
Functionioq1363D
()
main/1300-1399/1363D.go:61
Functionioq1365
()
main/1300-1399/1365G.go:51
Functionioq14
github.com/EndlessCheng/codeforces-go
main/1500-1599/1514E.go:9
Functionioq23
()
main/1000-1099/1023E.go:49
Functionioq79
()
main/1400-1499/1479A.go:46
Functionioq86
()
main/1400-1499/1486C2.go:80
FunctionisArmstrong
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/5/b/b.go:9
MethodisBipartite
二分图判定+染色 注:二分图也叫偶图 https://en.wikipedia.org/wiki/Bipartite_graph https://oi-wiki.org/graph/bi-graph/#_3 https://cp-algorithms.com/graph/bipartite-chec
copypasta/graph.go:2179
FunctionisCircleRectangleOverlap
圆和矩形是否重叠 x1<x2, y1<y2 https://www.zhihu.com/question/24251545/answer/27184960 LC1401/双周赛23C https://leetcode-cn.com/contest/biweekly-contest-23/proble
copypasta/geometry.go:681
FunctionisCompleteTree
github.com/EndlessCheng/codeforces-go
leetcode/weekly/115/b/b.go:6
FunctionisCompleteTree2
我的憨憨写法
leetcode/weekly/115/b/b.go:24
FunctionisCovered
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/54/a/a.go:4
FunctionisCuboid
判断 6 个矩形是否为长方体的 6 个面 NEERC04 https://www.luogu.com.cn/problem/UVA1587
copypasta/misc.go:753
FunctionisEvenOddTree
(root *TreeNode)
leetcode/weekly/209/b/b.go:5
FunctionisGoodArray
(nums []int)
leetcode/weekly/161/d/d.go:3
FunctionisMajorityElement
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/6/a/a.go:4
FunctionisMonotonic
github.com/EndlessCheng/codeforces-go
leetcode/weekly/100/a/a.go:6
FunctionisPathCrossing
(s string)
leetcode/weekly/195/a/a.go:3
FunctionisPossible
LC 659 分割数组为长度至少为三且元素连续的子序列
leetcode/main.go:1404
FunctionisPossible
(a []int)
leetcode/weekly/176/d/d.go:15
FunctionisPossibleDivide
(nums []int, k int)
leetcode/weekly/168/b/b.go:5
FunctionisPrefixOfWord
(sentence string, searchWord string)
leetcode/weekly/190/a/a.go:5
FunctionisPrefixString
github.com/EndlessCheng/codeforces-go
leetcode/weekly/253/a/a.go:6
FunctionisPrintable
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/35/d/d.go:4
FunctionisSameAfterReversals
一行 github.com/EndlessCheng/codeforces-go
leetcode/weekly/273/a/a.go:6
← previousnext →6,801–6,900 of 8,098, ranked by callers