Serenity

热爱可抵岁月漫长

一个热爱技术、喜欢折腾的开发者。 专注于前端开发,偶尔写写后端。 记录生活,分享技术,探索未知。

点击任意处进入哦~
加载中
输入关键词开始搜索
acwing2.01背包问题

acwing2.01背包问题

朴素版(二维)状态f[i][j]定义:前 ii 个物品,背包容量 jj 下的最优解(最大价值):当前的状态依赖于之前的状态,可以理解为从初始状态f[0][0] = 0开始决策,有 NN 件物品,则需要 NN 次决 策,每一次对第 ii 件物品的决策,状态f[i][j]不断由之前的状态更新而来。2.

2月 Serenity
acwing859. Kruskal算法求最小生成树

acwing859. Kruskal算法求最小生成树

#include<iostream>#include<algorithm>using namespace std;const int N=1e5+10,M=2e5+10,INF=0x3f3f3f3f;int p[N],n,m;struct Edge{ int a,b,w

并查集 图论
2月 Serenity
acwing852. spfa判断负环

acwing852. spfa判断负环

#include<iostream>#include<cstring>#include<queue>using namespace std;const int N=1e5+10;int ne[N],e[N],h[N],idx,w[N];int n,m,dist[N

spfa
2月 Serenity
acwing851. spfa求最短路

acwing851. spfa求最短路

#include<iostream>#include<cstring>#include<queue>using namespace std;const int N=1e5+10;int ne[N],e[N],h[N],idx,w[N];int n,m,dist[N

spfa
2月 Serenity
acwing853. 有边数限制的最短路

acwing853. 有边数限制的最短路

#include<iostream>#include<cstring>using namespace std;const int N=510,M=10010;int n,m,k;int dist[N],last[N];struct Edge{ int a,b,c;

最短路径
1月 Serenity
acwing845. 八数码

acwing845. 八数码

暂无摘要...

1月 Serenity
acwing844. 走迷宫

acwing844. 走迷宫

#include<iostream>#include<cstring>#include<queue>using namespace std;typedef pair<int,int> PII;const int N=105;int n,m,g[N][N

bfs
1月 Serenity
acwing840. 模拟散列表

acwing840. 模拟散列表

拉链法#include<iostream>#include<cstring>using namespace std;const int N=100003;int e[N],ne[N],h[N],idx;void insert(int x){ int k=(x%N+N)%

哈希
1月 Serenity
acwing838. 堆排序

acwing838. 堆排序

#include<iostream>using namespace std;const int N=1e5+10;int n,m,a[N],cnt;void down(int x){ int u=x; if(2*x<=cnt&&a[2*x]<a[u

排序
1月 Serenity
acwing240. 食物链

acwing240. 食物链

题目描述动物王国中有三类动物 A,B,C,这三类动物的食物链构成了有趣的环形。A 吃 B,B 吃 C,C 吃 A。现有 N 个动物,以 1∼N 编号。每个动物都是 A,B,C 中的一种,但是我们并不知道它到底是哪一种。有人用两种说法对这 N 个动物所构成的食物链关系进行描述:第一种说法是 1 X Y

并查集
1月 Serenity