上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 25 下一页
摘要: 先上模板,应该每个人都写得差不多的:基本上包含了sbt的所有基本操作。View Code 1 #include <cstdio> 2 #include <cstdlib> 3 #include <cstring> 4 #include <iostream> 5 #include <algorithm> 6 7 #define N 100010 8 9 using namespace std; 10 11 int key[N],lt[N],rt[N],sz[N]; 12 int root,cnt; 13 14 void rotate_l 阅读全文
posted @ 2013-01-13 15:36 proverbs 阅读(2826) 评论(2) 推荐(0) 编辑
摘要: 题意:题解:今天又遇到这个类型的建图题,有没有做出来。于是今天总结一下这个题的模型——顶点覆盖(每个顶点恰好覆盖一次)。先不考虑赋初值的费用:考虑赋初值:具体做法请参考:http://www.cnblogs.com/proverbs/archive/2013/01/06/2848043.html尽管不是一道题目,但是其实思想是一样的,赋初值=瞬移View Code 1 #include <iostream> 2 #include <cstring> 3 #include <cstdio> 4 #include <cstdlib> 5 6 #def 阅读全文
posted @ 2013-01-12 18:08 proverbs 阅读(258) 评论(0) 推荐(0) 编辑
摘要: 以:BZOJ1927: [Sdoi2010]星际竞速 为例以前我写的:注意updata()函数View Code 1 #include <iostream> 2 #include <algorithm> 3 #include <cstring> 4 #include <cstdio> 5 #include <cstdlib> 6 7 #define N 10000 8 #define M 1000000 9 10 using namespace std;11 12 int head[N],next[M],to[M],pr[M],len 阅读全文
posted @ 2013-01-12 15:46 proverbs 阅读(190) 评论(0) 推荐(0) 编辑
摘要: 题解:http://wenku.baidu.com/view/0ad00abec77da26925c5b01c.html吐槽这题数据,本地测全wa,就一直对拍,最后毛了,交了一发,ac了。。。难道这个题是spj?View Code 1 #include <iostream> 2 #include <cstring> 3 #include <cstdio> 4 #include <cstdlib> 5 #include <algorithm> 6 #include <ctime> 7 8 #define N 20000 9 阅读全文
posted @ 2013-01-11 22:22 proverbs 阅读(644) 评论(0) 推荐(0) 编辑
摘要: 题意:有N 颗糖果和M 个小孩,老师现在要把这N 颗糖分给这M 个小孩。每个小孩i对每颗糖j 都有一个偏爱度Aij,如果他喜欢这颗糖,Aij = 2,否则 Aij = 1。小孩 i觉得高兴当且仅当∑Cij×Aij >= Bi,j=1,2, …,N ,若他分得了糖 j ,Cij = 1,否则 Cij =0。问能否合理分配这 N 颗糖,使得每个小孩都觉得高兴。(1 <= N <= 100,000, 1 <=M <= 10, 0 <= Bi <= 1,000,000,000)题解:真心给这个题跪了。。。官方题解见Edelweiss的网络流建模总结 阅读全文
posted @ 2013-01-11 20:54 proverbs 阅读(602) 评论(2) 推荐(0) 编辑
摘要: 题意:判断线段是否与矩形相交。ps:矩形坐标不是按顺序给出的,需要自行判断友情提示,线段在矩形内部也输出T题解:叉积判断是否规范相交,再用点积判断部分重合的情况~计算几何一定要严谨啊!!!!PS:此代码不算严谨,严谨的请移步:http://www.cnblogs.com/proverbs/archive/2013/02/23/2923776.html这个代码就不做修改了View Code 1 #include <iostream> 2 #include <cstring> 3 #include <cstdio> 4 #include <algorith 阅读全文
posted @ 2013-01-10 23:40 proverbs 阅读(386) 评论(0) 推荐(0) 编辑
摘要: 题意:求从目标点走矩形框至少要穿越多少条边。题解:从矩形框上穿出等价于从直线与矩形框的顶点穿出。矩形框四个角特判!View Code 1 #include <iostream> 2 #include <cstring> 3 #include <cstdlib> 4 #include <cstdio> 5 #include <algorithm> 6 7 #define N 10000 8 #define EPS 1e-8 9 10 using namespace std;11 12 struct LI13 {14 double x,y 阅读全文
posted @ 2013-01-10 22:40 proverbs 阅读(251) 评论(0) 推荐(0) 编辑
摘要: 题意:给出n条线段,判断是否存在有一条直线,满足所有的线段在直线上投影后至少有一个公共点等价于:给出n条线段,问你是否存在一条直线,使得每个线段与该直线至少有一个交点。题解:嗯,猜测直线一定过至少两个端点。若不过某线段端点,则可以通过平应找到过一个端点的位置若过一个端点,则可以旋转使其通过两个端点暴力枚举端点,判线段直线相交即可~细节好多,被坑了。。。View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 #include <algorithm> 5 #i 阅读全文
posted @ 2013-01-10 21:24 proverbs 阅读(448) 评论(0) 推荐(0) 编辑
摘要: 题意:此题给出N组直线,每组2条直线。如果共线则输出LINE,相交则输入点坐标,否则输出NONE(平行)。题解:点积判断平行和相交,有向面积(分点公式)求交点(不知道写的对不对,至少能过这个题,貌似数据很弱的样子)。View Code 1 #include <iostream> 2 #include <cstring> 3 #include <cstdio> 4 #include <cstdlib> 5 #include <algorithm> 6 #include <cmath> 7 8 #define EPS 1e-7 阅读全文
posted @ 2013-01-10 21:17 proverbs 阅读(759) 评论(0) 推荐(0) 编辑
摘要: 题意:按顺序给出一些木棍,输出在最上面的木棍标号题解:一开始看到n=100000还在想怎么优化,没想出来,最后看讨论,原来暴力可以水过~嘿嘿~用了下并查集压缩路径,在刷数组的时候会快一些~View Code 1 #include <iostream> 2 #include <cstring> 3 #include <cstdlib> 4 #include <cstdio> 5 #include <algorithm> 6 7 #define N 110000 8 #define EPS 1e-8 9 10 using namespac 阅读全文
posted @ 2013-01-10 21:13 proverbs 阅读(186) 评论(0) 推荐(0) 编辑
上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 25 下一页