码迷,mamicode.com
首页 >  
搜索关键字:zoj 线段树    ( 12657个结果
zoj 1648 Circuit Board
题目:意思就是判断给定的几条线段是否有相交的。 方法:模版吧,有空在来细细学习。 代码: #include #include using namespace std; struct Point { double x,y; }; struct LineSeg { Point a,b; }; double Cross(Point a, Point b, Poi...
分类:其他好文   时间:2014-05-10 03:39:07    阅读次数:326
Wikilo 1191线段树区间修改单点查询
这题也算比较容易的了。 如果哪个区间已经没有黑色的话,就不用update了,就是因为这个原因WA了2发,唉…… #include #include #include #include #include #include #include #include #include #include #include #include #define PI acos(-1.0) ...
分类:其他好文   时间:2014-05-09 22:55:55    阅读次数:341
Wikioi 2492 树状数组+并查集(单点更新区间查询)
刚开始做的时候用线段树做的,然后就跳进坑里了……因为要开方,所以区间的值都得全部变,然后想用lazy标记的,但是发现用不了,单点更新这个用不了,然后就不用了,就T了。然后实在不行了,看了别人的题解,原来是用树状数组+并查集的方法,唉……没想到啊! 因为开方之后多次那个数就会变成1了,所以是1的时候开方下去就没用了。树状数组更新的时候就把其更新的差更新即可,太机智了这题…… 昨天做了,然后出错找...
分类:其他好文   时间:2014-05-09 22:35:22    阅读次数:290
[容斥原理] zoj 3556 How Many Sets I
题目链接: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4535 How Many Sets I Time Limit: 2 Seconds      Memory Limit: 65536 KB Give a set S, |S| = n, then how many ordered set g...
分类:其他好文   时间:2014-05-09 13:50:00    阅读次数:347
zoj 1904 Beavergnaw 计算圆柱和圆台的体积
题目来源:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=904题意: 看图, 给出D, 和 抠掉的木材的体积V, 求图中 d.圆柱体积: pi * r^2 * h圆台体积: pi * (r1 ^2 + r2^2 + r1 *r2...
分类:其他好文   时间:2014-05-09 10:43:33    阅读次数:362
ZOJ 3780 Paint the Grid Again(topsort)
ZOJ Problem Set - 3780 Paint the Grid Again Time Limit: 2 Seconds      Memory Limit: 65536 KB Leo has a grid with N × N cells. He wants to paint each cell with a specific color (either black ...
分类:其他好文   时间:2014-05-09 02:00:35    阅读次数:506
zoj1444 Final Standings解题报告
想不到学ACM这么久,我还是通过这个题目才了解到ACM比赛中的具体成绩规则!!!!...
分类:其他好文   时间:2014-05-09 01:36:55    阅读次数:225
Wikioi 1082线段树成段更新成段查询
这题从昨晚搞到现在敲了又改好久,刚开始是update中错了,然后找到了。但是还错,然后因为题目没有数据的范围提示,所以弄了好久都不知道哪错了,最后看评论才知道是超int了,改了之后还有错,然后才发现虽然改成long long了,但是输出的时候没改,哈哈…… #include #include #include #include #include #include #include...
分类:其他好文   时间:2014-05-09 01:20:40    阅读次数:280
HDU 4578 线段树区间更新(确定区间操作的优先级)
HDU 4578 线段树区间更新 操作有: 区间所有数add(c) 区间所有数mul(c) 区间所有数set(c) 查询有: 区间所有数的p次方和(p>= 1 && p 关键是区间更新的三种操作的优先级的确定清楚 关键是:down和update中对区间的更新操作是一回事,可以写成函数方便编程 //#pragma warning (disable: 47...
分类:其他好文   时间:2014-05-09 01:08:38    阅读次数:432
ZOJ 3229 有上下界最大流
1: /** 2: ZOJ 3229 有上下界的最大流 3: 两次求最大流的过程,非二分 4: 有源汇上下界的最大流问题, 首先连接 sink -> src, [0,INF]. 5: 根据net的正负,来建立 Supersrc 与 supersink 之间的边,做一次 maxflow. 6: 若所有...
分类:其他好文   时间:2014-05-08 22:39:11    阅读次数:412
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!