
图论
THE END GAME
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
补图的连通块
求解一个图的补图的连通块 /*求补图的连通块*/ #include <bits/stdc++.h> #define ll long long using namespace std; const int N = 1e5+5; set<int>G[N]; int n,m; set<int>s; int vis[N]; set<int>::itera...原创 2019-11-13 17:17:14 · 424 阅读 · 0 评论 -
G - Arbitrage
题目 https://cn.vjudge.net/contest/256498#problem/G //数据量很小的多源最短路——Floyd //若数据量很大还是用迪杰斯特拉比较好 #include<cstdio> #include<iostream> #include<algorithm> #include<queue> #include<c...原创 2019-03-30 18:16:07 · 198 阅读 · 0 评论 -
小梨花的连通图
题解: 直接对每个连通块进行染色即可。如果两个点在k张图中都是连通的,说明这两个点在k张图中的颜色都是一样的。 用map<vector,int>统计答案即可 染色问题 #include<bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; int n, k, nowcolor; vector<i...转载 2019-05-20 08:05:38 · 191 阅读 · 0 评论 -
图论
#include<bits/stdc++.h> /************************ 链式向前星 ************************/ using namespace std; #define MAXN 100501 struct NODE{ int w;//第i条边的权值 int e;//第i条边的终点 int next; //next[i...原创 2019-02-19 01:32:35 · 104 阅读 · 0 评论 -
染色和拓扑排序
邻接矩阵 判定二分图:一个无向图为二分图当且仅当图G中无奇数长度的回路。 #include <queue> #include <cstring> #include <iostream> using namespace std; const int N = 999; int col[N], Map[N][N]; //0为白色,1为黑色 bool BFS(int...原创 2019-02-19 01:18:45 · 291 阅读 · 0 评论 -
欧拉图和哈密顿图
存在性判定 欧拉回路:从图中某一顶点出发,所有边仅经过一次,最后回到该顶点。 无向图:所有顶点度数为偶数 有向图:所有顶点出度和入度相等 欧拉路径:从图中某一顶点出发,图中每条边经过一次,最后到达某个点。 至多有两个顶点度数为奇数 至多有两个顶点出入度数之差为1 哈密顿图:哈密顿路经过图的所有顶点一次且仅仅一次。 存在哈密顿回路的图称为哈密顿图。 在n阶简单图中,若任一对不相邻顶点(u, v)有d...原创 2019-02-19 01:08:45 · 1239 阅读 · 0 评论 -
暑假集训日记——7.6(scc)
E. Count Pairs 题解: #include <bits/stdc++.h> #define N 300500 using namespace std; map<int,long long> mm; int n,p,K,a[N]; long long Ans; int main(){ scanf("%d%d%d",&n,&p,&K); ...原创 2019-07-07 08:49:36 · 221 阅读 · 0 评论 -
暑假集训日记——7.23(codeforce)
D. Beautiful Graph 二分图+联通分支+快速幂…我是打算这么求得,但好像太麻烦了… #include <bits/stdc++.h> using namespace std; const int N = int(3e5) + 999; const int MOD = 998244353; int n, m; vector <int> g[N]; in...原创 2019-07-27 13:41:14 · 166 阅读 · 0 评论 -
小A的最短路
LCA算法 #include <iostream> #include <cstdio> #include <cmath> #include <algorithm> #include <map> #include <queue> #include <vector> #include <cstring> ...转载 2019-08-15 14:35:23 · 125 阅读 · 0 评论