![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法复习
文章平均质量分 88
蜗角虚名羊
这个作者很懒,什么都没留下…
展开
-
树状数组
poj3321 apple tree#include<iostream>#include<cstdio>#include<cstring>using namespace std;const int N=100003;s原创 2018-05-17 22:08:26 · 115 阅读 · 0 评论 -
gcd&exgcd&crt&excrt
var a,b:int64;function gcd(a,b,c:int64):int64;beginif (a=0)or(b=0) then exit(1);exit((gcd(b mod a,a,-c)*b+c) div a);end;beginreadln(a,b);writeln((gcd(a,b,1)) mod b);end.原创 2018-07-06 21:39:18 · 300 阅读 · 0 评论 -
高斯消元
POJ 1222 EXTENDED LIGHTS OUTPOJ 1681 Painter’s ProblemPOJ 1753 Flip GamePOJ 1830 开关问题POJ 3185 The Water BowlsPOJ 2947 Widget FactoryPOJ 1166 The ClocksHDU 3949 XOR(线性基模板)POJ 1222 EXTE...原创 2018-07-06 22:09:16 · 147 阅读 · 0 评论 -
计算几何1
模板typedef double D;const D eps=1e-6,inf=1e99;struct P{ D x,y; P(){}; P(D xx,D yy){x=xx;y=yy;} friend P operator+(P p1,P p2){return P(p1.x+p2.x,p1.y+p2.y);} friend P operator-...原创 2018-07-19 22:58:15 · 175 阅读 · 0 评论 -
计算几何2
凸包: https://blog.csdn.net/bone_ace/article/details/46239187 旋转卡壳算法: https://blog.csdn.net/wang_heng199/article/details/74477738 http://www.cnblogs.com/xdruid/archive/2012/07/01/2572303.html 半平面交:...原创 2018-07-19 23:03:08 · 186 阅读 · 0 评论 -
容斥原理
HDU 1695 GCDHDU 2204 Eddy’s爱好HDU 4407UVA11806 CheerleadersHDU 2841HDU 4135 POJ2773TopCoder - 10875 CarelessSecretaryTopCoder - 8470 CharmingTicketsEasy TopCoder - 8307 SetOfPatternsTopCode...原创 2018-07-19 23:18:11 · 429 阅读 · 0 评论 -
2-SAT
学习博客 位运算转换为2-sat的方法: x表示x这个点是0,x’表示x这个点是1 如果a and b==0 连接a’->b b’->a 如果a and b==1 连接a->a’ b->b’ 如果a or b==0 连接a’->a b’->b 如果a or b==1 连接a-&原创 2018-07-30 15:10:36 · 167 阅读 · 0 评论 -
二分图匹配
HDU 4185 Oil Skimmingpoj1469(hopcroft-karp算法)HDU 1507 Uncle Tom’s Inherited Land*ZOJ1654-Place the RobotsHDU 4751 Divide Groups HDU 4685 Prince and PrincessHDU 4185 Oil Skimming//ht...原创 2018-07-30 15:24:39 · 149 阅读 · 0 评论 -
左偏树 可并堆
文章目录模板[boi2004 sequence(bzoj1367)](http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1367)[poj3016 K-Monotonic](http://poj.org/problem?id=3016)[bzoj2809 [APIO2012]dispatching](http://acm.zj...原创 2019-01-12 20:42:41 · 116 阅读 · 0 评论 -
最大流
文章目录模板[poj1698](http://poj.org/problem?id=1698)[bzoj1497 noi2006 最大获利](http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1497)[bzoj1458](http://acm.zju.edu.cn/onlinejudge/showProblem.do?pro...原创 2019-01-12 20:48:27 · 152 阅读 · 0 评论 -
错误整理
各种错误整理+其他注意 一、long long(int 64) @10.26 Inside Contest 有些题目虽然读入都是int(longint),但加起来答案会超过int(longint) 很多要求输出方案数的题目没有mod的话很容易超int(longint),有mod要注意中间程是否会超int(longint)。 有时答案甚至会爆long long(int64),...原创 2018-07-09 21:51:34 · 267 阅读 · 2 评论 -
矩阵
常见的构造方法POJ3233 Matrix power serieshdu1588 Gauss FibonacciHDu4686 Arc of Dreamhdu2371 题目链hdu2157 How many ways??poj3613 Cow RelaysHDU 3306 Another kind of FibonacciHDU5171POJ3233 Ma...原创 2018-06-26 19:32:27 · 164 阅读 · 0 评论 -
线段树
题目博客 PKU1177 Picture 参见my blog hdu3954 level up#include<iostream>#include<cstdio>using namespace std;const int N=10003;struct node{ int exp,lev,dis,l原创 2018-05-17 22:05:50 · 172 阅读 · 0 评论 -
AC自动机
POJ 1625#include<cstdio>#include<algorithm>#include&am原创 2018-05-12 17:20:30 · 236 阅读 · 0 评论 -
博弈论
博弈原理原创 2018-05-15 20:12:10 · 372 阅读 · 0 评论 -
kmp
学习文档:http://www.cnblogs.com/c-cloud/p/3224788.html1.Number Sequence 题意:给T组数据,每组有长度为n和m的母串和模式串。判断模式串是否是母串的子串,如果是输出最先匹配完成的位置,否则输出-1.#include<iostream>#include<cstdio>using namespace...原创 2018-05-17 22:23:21 · 183 阅读 · 0 评论 -
强联通/lca tarjan
强联通: hdu3861 The King’s Problem#include<cstdio>#include<cstring>#include<queue>using namespace std;const int N=50003,M=100003,inf=1e8原创 2018-05-17 22:29:08 · 179 阅读 · 0 评论 -
单调队列
修剪草坪(mowlawn) 题目描述: 在一年前赢得了小镇的最佳草坪比赛后,FJ变得很懒,再也没有修剪过草坪。现在,新一轮的最佳草坪比赛又开始了,FJ希望能够再次夺冠。然而,FJ的草坪非常脏乱,因此,FJ只能够让他的奶牛来完成这项工作。FJ有N(1 <= N <= 100,000)只排成一排的奶牛,编号为1…N。每只奶牛的效率是不同的,奶牛i的效率为E_i(0 <= E_i&...原创 2018-05-17 22:41:48 · 557 阅读 · 0 评论 -
数位dp(记忆化和循环两种写法都有)
Beautiful numbers//https://www.cnblogs.com/xcw0754/p/4854539.html#include<bits/stdc++.h>using namespace std;typedef long long ll;const int M=2520;int p[49]={0,1,2,3,4,5,6,7,8,9,10,12,14...原创 2018-05-17 23:03:20 · 242 阅读 · 0 评论 -
概率论
学习博客原创 2018-05-27 15:09:50 · 434 阅读 · 0 评论 -
状压dp
//https://blog.csdn.net/albertluf/article/details/80338378#include<cstdio>#include<algorithm>#inc原创 2018-06-14 23:15:58 · 147 阅读 · 0 评论 -
划分树 主席树
文章目录[hdu2665(主席树模板)](http://acm.hdu.edu.cn/showproblem.php?pid=2665)[poj2104(划分树模板)](http://poj.org/problem?id=2104)[bzoj1901(树状数组套主席树)](http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=19...原创 2019-01-12 20:51:38 · 218 阅读 · 0 评论