
各类板子
文章平均质量分 57
sdau_blue
念念不忘,必有回响。驰而不息,功不唐捐。
展开
-
Poor God Water(杜教BM模板(用于线性))
God Water likes to eat meat, fish and chocolate very much, but unfortunately, the doctor tells him that some sequence of eating will make them poisonous.Every hour, God Water will eat one kind of fo...原创 2018-09-17 17:18:59 · 510 阅读 · 0 评论 -
The xor-longest Path(01字典树—求树上连续区间的最大异或值)
The xor-longest PathTime Limit: 2000MS Memory Limit: 65536K Total Submissions: 10003 Accepted: 2029 DescriptionIn an edge-weighted tree, the xor-length of a path p is defined a...原创 2018-10-17 13:03:25 · 806 阅读 · 0 评论 -
hdu4825—(01字典树模板)
hdu4825代码:#include<bits/stdc++.h>using namespace std;typedef long long LL;const int maxn=100000+10;int n,m;int tree[32*maxn][2];LL val[32*maxn];int tot;void insert_(LL d){ int ...原创 2018-10-16 22:22:34 · 472 阅读 · 0 评论 -
hdu1251(字典树模板)
#include<bits/stdc++.h>using namespace std;typedef long long LL;const int maxn=2000000+10;const int inf=0x3f3f3f3f;int tree[maxn][30];bool flagg[maxn];int sum[maxn];///有时要加这个数组,目的是为了统计以该...原创 2018-10-16 20:26:51 · 181 阅读 · 0 评论 -
求次短路和k短路(模板)
求次短路:Dijkstra的dist数组和vis数组再加一维,松弛的时候讨论当前的路小于最短路,或者大于最短路但小于次短路这两种情况,就能维护一个次短路了#include <cstdio>#include <cstring>#include <queue>#include <vector>#include <algorithm...原创 2018-10-09 19:08:12 · 822 阅读 · 0 评论 -
Game of Taking Stones(double大数。二分求根5(精确))
Game of Taking StonesTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1522 Accepted Submission(s): 515 Problem DescriptionTwo people f...原创 2018-10-09 17:25:09 · 411 阅读 · 0 评论 -
MASTER OF GCD(树状数组差分|线段树)
嗯。反正这道题当时忘记了树状数组差分。用的线段树。比赛时写这么长的线段树时间上多少有点吃亏。就是两个树,维护区间加1操作,然后分别查两棵树的最小值。树状数组差分:#include<bits/stdc++.h>using namespace std;const int maxn=100000+100;const int mod=998244353;...原创 2018-10-18 19:49:27 · 256 阅读 · 0 评论 -
poj2195
网络流,sap模板/*最大流模板sap*/#include<stdio.h>#include<string.h>#include<algorithm>#include<iostream>using namespace std;const int MAXN=100010;//点数的最大值const int MAXM=4000...原创 2018-10-14 19:41:58 · 399 阅读 · 0 评论 -
最小费用最大流模板
poj2195/*POJ 2195 Going Home邻接表形式最小费用最大流*/#include<stdio.h>#include<iostream>#include<algorithm>#include<string.h>#include<queue>using namespace std;const i...原创 2018-10-14 19:23:46 · 158 阅读 · 0 评论 -
线段树+扫描线(有关扫描线的理解)
扫描线:下面是来自soar转载的一篇博客。这篇博客解决了我对算区间长度时的不理解。实际上这个线段树的叶子节点保存的是这个点x坐标到下一个x坐标(排序后的)的区间长度。题意:二维平面有n个平行于坐标轴的矩形,现在要求出这些矩形的总面积. 重叠部分只能算一次.分析:线段树的典型扫描线用法. 首先假设有下图两个矩阵,我们如果用扫描线的方法如何计算它们的总面积呢?...原创 2018-10-12 21:07:21 · 25532 阅读 · 33 评论 -
hdu5971—Wrestling Match(二分图染色+并查集)
题意:就是有n个人,m场PK,每一场PK都保证了一个是good,一个是bad,然后给了X个已经知道的好人的编号和Y个已经知道的坏人的编号。然后问能否分成两个阵营。看样例:给的PK能将1,2,4,5分成两大块,但是2何去何从是未知的,所以是NO。下一个,2是good,所以能分成两大块。思路:1.利用染色的方法,看能否给已知的图进行染色,不成功说明矛盾输出no。...原创 2018-10-03 16:28:34 · 492 阅读 · 0 评论 -
kuangbin(dijstra算法模板)
1.vector不要忘记vector初始化!代码:#include<bits/stdc++.h>using namespace std;#define ll long longconst int mod=1e9+7;const int INF=0x3f3f3f3f;const int MAXN=2000010;struct qnode{ int v...原创 2018-10-02 17:40:44 · 1329 阅读 · 0 评论 -
Empty Convex Polygons(最大空凸包&&模板)
Empty Convex PolygonsTime Limit: 16000/8000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 581 Accepted Submission(s): 149 Problem DescriptionGiven a se...原创 2018-09-18 21:22:20 · 1007 阅读 · 0 评论 -
拓扑排序(板子)
1.从1-n编号的。判断DAG(有向无环图)是否有拓扑序列。模板代码:#include<bits/stdc++.h>using namespace std;const int maxn=1000;vector<int>G[maxn];int n,m;int in[maxn];bool topo(){ queue<int>Q; ...原创 2018-01-20 20:50:12 · 644 阅读 · 0 评论