codlz
codlz
全部文章
未归档
不抄模板能解题?(12)
后端开发实践(2)
题解(1)
归档
标签
去牛客网
登录
/
注册
这都不会?
全部文章
/ 未归档
(共51篇)
Huffman Codes 非建树
In 1953, David A. Huffman published his paper “A Method for the Construction of Minimum-Redundancy Codes”, and hence printed his name in the history o...
2021-05-06
0
407
0-1背包 一维数组 模板
#include <bits/stdc++.h> using namespace std; const int N = 1005; int dp[N]; int val[N], weight[N]; int main() { #ifndef ONLINE_JUDGE ...
2021-05-06
0
426
完全背包 一位数组 完全体 模板
#include <bits/stdc++.h> using namespace std; const int N = 1005; int dp[N]; int volume[N], val[N]; int main() { #ifndef ONLINE_JUDGE ...
2021-05-06
0
327
除法求值 带权并查集 力扣399
除法求值题目 class Solution { public: int find(int p, vector<int> &father, vector<double> & weight) { if (fath...
2021-05-06
0
400
1489. 找到最小生成树里的关键边和伪关键边 Kruskal
力扣 class Solution { public: vector<int> initDSU(int n) { //初始化并查集 vector<int> ret; for (int i = 0...
2021-05-06
0
400
力扣363 矩形区域不超过K的最大矩形
遍历矩形的上边界和下边界,将二维问题降为一维问题。 在遍历一维的时候,使用前缀和记录,选择符合条件的Sr 和 Sl 力扣 class Solution { public: int maxSumSubmatrix(vector<vector<int>>&...
2021-05-06
0
582
kruskal算法 最小生成树模板题 力扣1135最低成本联通所有城市
https://leetcode-cn.com/problems/connecting-cities-with-minimum-cost/ /* 最小生成树模板 */ class Solution { private int f[]; //父节点 private int w[...
2021-05-06
0
1017
二维树状数组,二维矩阵的单点修改区间查询,很慢
class NumMatrix { private: long tree[10005][10005]; int n, m; vector<vector<int>> matrix; public: int lowbit(int x) { ...
2021-05-02
0
573
树状数组求区间最大值和最小值
void Update(int i,int v) { while(i<=maxY) { t[i] = max(t[i],v); i += lowbit(i); } } int query(int i) { int ans = 0;...
2021-05-01
0
641
二维矩阵上的树状数组
例题 https://leetcode-cn.com/problems/range-sum-query-2d-mutable/ 一般的树状数组tree[i]记录的是以i为右端点,长度为lowbit(i)的区间和,实现单点修改区间查询。树状数组也可以实现矩阵上的单点修改区间查询 int ...
2021-05-01
0
364
首页
上一页
1
2
3
4
5
6
下一页
末页