MCPcopy Create free account

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

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

FunctionmakeGood
github.com/EndlessCheng/codeforces-go
leetcode/weekly/201/a/a.go:4
FunctionmakeStringSorted
(s string)
leetcode/biweekly/50/d/d.go:19
MethodmanhattanMST
曼哈顿距离最小生成树 O(nlogn) LC1584 https://leetcode-cn.com/problems/min-cost-to-connect-all-points/ 做法见官方题解 https://leetcode-cn.com/problems/min-cost-to-conne
copypasta/graph.go:1859
FunctionmapPos
b 是 a 的一个排列(允许有重复元素) 返回 b 中各个元素在 a 中的下标(重复的元素顺序保持一致) 可用于求从 a 变到 b 需要的相邻位元素交换的最小次数,即返回结果的逆序对个数 LC1850/周赛239C https://leetcode-cn.com/problems/minimum-a
copypasta/misc.go:406
FunctionmatrixBlockSum
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/17/b/b.go:4
FunctionmatrixRankTransform
github.com/EndlessCheng/codeforces-go
leetcode/weekly/212/d/d.go:6
Methodmax
()
copypasta/bst.go:280
FunctionmaxAbsValExpr
(a1 []int, a2 []int)
leetcode/weekly/146/d/d.go:3
FunctionmaxAlternatingSum
* 定义 $f[i][0]$ 表示前 $i$ 个数中长为偶数的子序列的最大交替和,$f[i][1]$ 表示前 $i$ 个数中长为奇数的子序列的最大交替和。 初始时有 $f[0][0] = 0$,$f[0][1] = -\infty$。 对于第 $i$ 个数,有选或不选两种决策。 对于 $f[
leetcode/biweekly/55/c/c.go:38
FunctionmaxArea
(h int, w int, a []int, b []int)
leetcode/weekly/191/b/b.go:5
FunctionmaxAscendingSum
github.com/EndlessCheng/codeforces-go
leetcode/weekly/233/a/a.go:6
FunctionmaxAverageRatio
(classes [][]int, ex int)
leetcode/weekly/232/c/c.go:17
MethodmaxBipartiteMatchingHopcroftKarp
二分图最大匹配 - Hopcroft–Karp 算法 O(m√n) https://en.wikipedia.org/wiki/Hopcroft%E2%80%93Karp_algorithm https://algs4.cs.princeton.edu/code/edu/princeton/cs/
copypasta/graph.go:2351
MethodmaxBipartiteMatchingHungarian
* 匹配 带权匹配 独立集 边覆盖 顶点覆盖 路径覆盖 支配集 https://en.wikipedia.org/wiki/Matching_(graph_theory) https://en.wikipedia.org/wiki/Maximum_weight_matching https://en
copypasta/graph.go:2286
MethodmaxBipartiteMatchingHungarianLR
匈牙利算法的另一种写法,适用左右两侧节点有明确区分的情况,要求 g 中存储的是左侧到右侧的单向边
copypasta/graph.go:2316
FunctionmaxBuilding
github.com/EndlessCheng/codeforces-go
leetcode/weekly/238/d/d.go:6
FunctionmaxCandies
(status []int, candies []int, keys [][]int, containedBoxes [][]int, initialBoxes []int)
leetcode/weekly/168/d/d.go:3
FunctionmaxCoins
github.com/EndlessCheng/codeforces-go
leetcode/weekly/203/b/b.go:6
FunctionmaxCompatibilitySum
(students [][]int, mentors [][]int)
leetcode/weekly/251/c/c.go:73
FunctionmaxConsecutiveAnswers
同 1004. 最大连续1的个数 III https://leetcode-cn.com/problems/max-consecutive-ones-iii/ github.com/EndlessCheng/codeforces-go
leetcode/biweekly/62/c/c.go:6
FunctionmaxCoveredPoints
求一固定半径的圆最多能覆盖多少个点(圆边上也算覆盖) len(ps)>0 && r>0 Angular Sweep 算法 O(n^2logn) https://www.geeksforgeeks.org/angular-sweep-maximum-points-can-enclosed-circle
copypasta/geometry.go:637
FunctionmaxDepth
github.com/EndlessCheng/codeforces-go
leetcode/weekly/210/a/a.go:4
FunctionmaxDiff
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/25/b/b.go:10
FunctionmaxDistance
github.com/EndlessCheng/codeforces-go
leetcode/weekly/202/c/c.go:6
FunctionmaxDistance
* O(n) 做法 先判断最左右的两栋房子颜色是否相同,若不同直接返回 $n-1$。 若相同,则可以在其余位置(尽量靠近左或右)找到颜色不同于最左右房子颜色的房子,计算其到左右的最远距离,即为答案。 */ github.com/EndlessCheng/codeforces-go
leetcode/weekly/268/a/a.go:11
FunctionmaxDistance
github.com/EndlessCheng/codeforces-go
leetcode/weekly/240/b/b.go:6
FunctionmaxDistance
(grid [][]int)
leetcode/weekly/150/c/c.go:3
FunctionmaxDotProduct
(a, b []int)
leetcode/weekly/190/d/d.go:3
FunctionmaxEqualFreq
github.com/EndlessCheng/codeforces-go
leetcode/weekly/158/d/d.go:6
FunctionmaxEqualFreq2
(a []int)
leetcode/weekly/158/d/d.go:22
FunctionmaxEqualRowsAfterFlips
(mat [][]int)
leetcode/weekly/139/b/b.go:50
FunctionmaxEqualRowsAfterFlips_N3
(mat [][]int)
leetcode/weekly/139/b/b.go:3
FunctionmaxEvents
(a [][]int)
leetcode/weekly/176/c/c.go:5
MethodmaxFlowDinic
圆方树 todo https://www.luogu.com.cn/blog/PinkRabbit/Introduction-to-Round-Square-Tree * 网络流·总结·题单 ######################################################
copypasta/graph.go:3203
MethodmaxFlowHLPP
(in io.Reader, n, m, st, end int)
copypasta/graph.go:3469
MethodmaxFlowISAP
ISAP, Improved Shortest Augmenting Path O(n^2 * m) https://oi-wiki.org/graph/flow/max-flow/#isap https://www.renfei.org/blog/isap.html 测试了一下性能和 Dinic
copypasta/graph.go:3353
FunctionmaxFreq
(ss string, maxLetters int, minSize int, maxSize int)
leetcode/weekly/168/c/c.go:42
FunctionmaxFrequency
github.com/EndlessCheng/codeforces-go
leetcode/weekly/238/b/b.go:6
FunctionmaxGeneticDifference
(parents []int, queries [][]int)
leetcode/weekly/250/d/d.go:50
FunctionmaxHeight
(a [][]int)
leetcode/weekly/219/d/d.go:8
FunctionmaxIceCream
github.com/EndlessCheng/codeforces-go
leetcode/weekly/237/b/b.go:6
FunctionmaxJumps
(a []int, d int)
leetcode/weekly/174/d_nlogn.go:60
FunctionmaxJumps
注:可以用单调队列 DP 优化到 O(n) https://leetcode-cn.com/circle/article/W7083y/
leetcode/weekly/174/d/d.go:5
FunctionmaxLength
(arr []string)
leetcode/weekly/160/c/c.go:41
FunctionmaxLengthBetweenEqualCharacters
github.com/EndlessCheng/codeforces-go
leetcode/weekly/211/a/a.go:6
FunctionmaxLengthBetweenEqualCharacters2
(s string)
leetcode/weekly/211/a/a.go:24
FunctionmaxLevelSum
(root *TreeNode)
leetcode/weekly/150/b/b.go:9
FunctionmaxMatrixSum
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/59/b/b.go:4
FunctionmaxNiceDivisors
(n int)
leetcode/weekly/234/d/d.go:6
FunctionmaxNonOverlapping
github.com/EndlessCheng/codeforces-go
leetcode/weekly/201/c/c.go:4
FunctionmaxNumEdgesToRemove
github.com/EndlessCheng/codeforces-go
leetcode/weekly/205/d/d.go:39
FunctionmaxNumOfSubstrings
github.com/EndlessCheng/codeforces-go
leetcode/weekly/198/c/c.go:6
FunctionmaxNumber
(nums1, nums2 []int, k int)
leetcode/main.go:1119
FunctionmaxNumberOfApples
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/9/a/a.go:6
FunctionmaxNumberOfFamilies
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/22/b/b.go:4
FunctionmaxOperations
github.com/EndlessCheng/codeforces-go
leetcode/weekly/218/b/b.go:4
FunctionmaxPathSum
LC 124
leetcode/main.go:574
FunctionmaxPerformance
(n int, speed []int, efficiency []int, k int)
leetcode/weekly/180/d_pq.go:17
FunctionmaxPerformance
(n int, speed, efficiency []int, k int)
leetcode/weekly/180/d/d.go:100
FunctionmaxPoints
* DP 优化技巧:拆项+前后缀最大值 本文用 $n$ 表示行数,$m$ 表示列数。 定义 $f[i][j]$ 表示前 $i$ 行中,第 $i$ 行选择 $\textit{points}[i][j]$ 时的最大得分,则有 $$ f[i][j] = \textit{points}[i][j] +
leetcode/weekly/250/c/c.go:42
FunctionmaxPower
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/26/a/a.go:4
FunctionmaxProbability
(n int, edges [][]int, succProb []float64, st, end int)
leetcode/weekly/197/c/c.go:25
FunctionmaxProduct
LC 152
leetcode/main.go:863
FunctionmaxProduct
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/58/d/d.go:4
FunctionmaxProduct
** * Definition for a binary tree node. * type TreeNode struct { * Val int * Left *TreeNode * Right *TreeNode * } */
leetcode/weekly/174/c/c.go:13
FunctionmaxProduct
Go 爆搜 github.com/EndlessCheng/codeforces-go
leetcode/weekly/258/c/c.go:6
FunctionmaxProduct
(a []int)
leetcode/weekly/191/a/a.go:3
FunctionmaxProductDifference
github.com/EndlessCheng/codeforces-go
leetcode/weekly/247/a/a.go:6
FunctionmaxProductPath
github.com/EndlessCheng/codeforces-go
leetcode/weekly/207/c/c.go:4
FunctionmaxProfit
github.com/EndlessCheng/codeforces-go
leetcode/weekly/214/c/c.go:6
FunctionmaxProfitMaxTwice
LC 123
leetcode/main.go:555
FunctionmaxRepeating
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/40/a/a.go:6
FunctionmaxResult
(a []int, k int)
leetcode/weekly/220/c/c.go:31
FunctionmaxSatisfaction
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/23/d/d.go:6
FunctionmaxScore
(s string)
leetcode/weekly/186/a/a.go:5
FunctionmaxScore
(a []int, k int)
leetcode/weekly/186/b/b.go:3
FunctionmaxScoreWords
(words []string, letters []byte, score []int)
leetcode/weekly/162/d/d.go:3
FunctionmaxSideLength
(mat [][]int, threshold int)
leetcode/weekly/167/c/c.go:3
FunctionmaxSizeSlices
(A []int)
leetcode/biweekly/22/d/d.go:18
FunctionmaxSizeSlices2
O(n^2) 做法
leetcode/biweekly/22/d/d.go:50
FunctionmaxStudents
(mat [][]byte)
leetcode/weekly/175/d/d.go:3
FunctionmaxSubsequence
两次排序 github.com/EndlessCheng/codeforces-go
leetcode/biweekly/67/a/a.go:8
FunctionmaxSum
github.com/EndlessCheng/codeforces-go
leetcode/weekly/200/d/d.go:4
FunctionmaxSumBST
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/21/d/d.go:6
FunctionmaxSumBST2
这种写法是错误的,见 [9,4,10,null,null,6,11] => 27
leetcode/biweekly/21/d/d.go:36
FunctionmaxSumDivThree
(nums []int)
leetcode/weekly/163/main.go:82
FunctionmaxSumDivThree
(nums []int)
leetcode/weekly/163/c/c.go:5
FunctionmaxSumMinProduct
github.com/EndlessCheng/codeforces-go
leetcode/weekly/240/c/c.go:4
FunctionmaxSumRangeQuery
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/35/b/b.go:6
FunctionmaxSumTwoNoOverlap
github.com/EndlessCheng/codeforces-go
leetcode/weekly/133/c/c.go:4
FunctionmaxTaskAssign
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/65/d/d.go:6
FunctionmaxTaxiEarnings
* 动态规划 定义 $f[i]$ 表示行驶到 i 时的最大盈利。考虑状态转移,一方面,我们可以不接终点为 $i$ 的乘客,这样有 $f[i]=f[i-1]$;另一方面,我们可以接所有终点为 $i$ 的乘客,这样有 $f[i] = \max f[start]+end-start+tip$,二者取最大
leetcode/biweekly/61/c/c.go:12
FunctionmaxTotalFruits
github.com/EndlessCheng/codeforces-go
leetcode/weekly/271/d/d.go:6
FunctionmaxTwoEvents
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/64/b/b.go:9
FunctionmaxUniqueSplit
github.com/EndlessCheng/codeforces-go
leetcode/weekly/207/b/b.go:4
FunctionmaxValue
github.com/EndlessCheng/codeforces-go
leetcode/weekly/243/b/b.go:4
FunctionmaxValue
(n, i, maxSum int)
leetcode/weekly/233/c/c.go:16
FunctionmaxValueAfterReverse
github.com/EndlessCheng/codeforces-go
leetcode/biweekly/18/d/d.go:4
FunctionmaxVowels
我的憨憨写法
leetcode/weekly/190/b/b.go:6
FunctionmaxVowels2
优雅的写法:前缀和
leetcode/weekly/190/b/b.go:37
← previousnext →7,301–7,400 of 8,098, ranked by callers