计算几何专题
文章平均质量分 52
主要分享我对一些计算几何的心得与经验
SC.ldxcaicai
我很菜=_=
展开
-
2018.10.18 bzoj1185: [HNOI2007]最小矩形覆盖(旋转卡壳)
传送门不难看出最后的矩形一定有一条边与凸包某条边重合。因此先求出凸包,然后旋转卡壳求出当前最小矩形面积更新答案。代码:#include<bits/stdc++.h>#define N 50005#define eps 1e-9using namespace std;struct pot{ long double x,y; inline pot operator+(c...原创 2018-10-18 10:39:48 · 189 阅读 · 0 评论 -
2018.10.18 poj2187Beauty Contest(旋转卡壳)
传送门旋转卡壳板子题。就是求凸包上最远点对。直接上双指针维护旋转卡壳就行了。注意要时刻更新最大值。代码:#include<iostream>#include<cstdio>#include<algorithm>#define N 50005using namespace std;inline int read(){ int ans=0,...原创 2018-10-18 08:33:16 · 163 阅读 · 0 评论 -
2018.10.15 bzoj4570: [Scoi2016]妖怪(凸包)
传送门不得不说这题有点东西啊。看到题第一眼二分,用二次函数求范围来进行checkcheckcheck,20分滚粗了233.于是开始思考正解。发现可以把每只怪物的二元组属性看成二维坐标。这时对于一只怪物(x,y)(x,y)(x,y),一种环境相当于是一条过了点(x,y)(x,y)(x,y)的直线,贡献就是在横纵坐标的截距之和。观察之后很容易发现答案只跟所有点的右上凸壳有关系。于是我们...原创 2018-10-15 20:55:53 · 105 阅读 · 0 评论 -
2018.10.15 bzoj4445: [Scoi2015]小凸想跑步(半平面交)
传送门话说去年的省选计算几何难度跟前几年比起来根本不能做啊(虽然去年考的时候并没有学过计算几何)这题就是推个式子然后上半平面交就做完了。什么?怎么推式子?先把题目的概率转换成求出可行区域。然后用可行区域的面积比上总面积就是答案了。我们设0号点(x1,y1)(x1,y1)(x1,y1),1号点(x2,y2)(x2,y2)(x2,y2),i号点(x3,y3)(x3,y3)(x3,y3),...原创 2018-10-15 19:15:29 · 128 阅读 · 0 评论 -
2018.10.03 bzoj3707: 圈地(计算几何)
传送门计算几何好题。本蒟蒻表示不看题解只会O(n3)O(n^3)O(n3)。正解是先考虑把直线按照斜率从小到大排序,然后把点按坐标排序。这样每次枚举到直线(a,b)(a,b)(a,b)时,离直线a,ba,ba,b最近的点只能在a,ba,ba,b在点序列中相邻的两个点上取到,然后在转过这条直线之后,(a,b)(a,b)(a,b)关于直线的相对位置会发生变化,所以每次转过之后交换a,ba,b...原创 2018-10-03 14:51:32 · 365 阅读 · 0 评论 -
2018.10.02 bzoj3190: [JLOI2013]赛车(半平面交)
传送门计算几何经典题。显然可以做出每个人的x−tx-tx−t图像,发现就是求半平面交上的点。注意舍去交点不在一象限的点。代码:#include<bits/stdc++.h>#define N 10005using namespace std;inline int read(){ int ans=0; char ch=getchar(); while(!isdig...原创 2018-10-03 13:30:50 · 290 阅读 · 0 评论 -
2018.10.03 bzoj1610:Line连线游戏(计算几何)
传送门计算几何入门题,直接算出所有直线的斜率看有多少种不同就行了。注意处理斜率不存在的情况。代码:#include<bits/stdc++.h>#define N 205using namespace std;inline int read(){ int ans=0,w=1; char ch=getchar(); while(!isdigit(ch)){if(ch=...原创 2018-10-03 11:52:37 · 262 阅读 · 0 评论 -
2018.09.28 牛客网contest/197/B面积并(二分+简单计算几何)
传送门比赛的时候把题目看成求面积交了,一直没调出来。下来发现是面积并气的吐血。码了一波发现要开long double。然而直接用现成的三角函数会挂。因此需要自己手写二分求角度。大致思路就是先判掉第二个圆不与多边形相交的情况。然后如果相交这个图形是可以通过旋转2kπ/n2k\pi/n2kπ/n得到的,因此我们只用求出一个等腰三角形和一个扇形并起来就行了。代码:#include&l...原创 2018-09-28 23:39:57 · 147 阅读 · 0 评论 -
2018.08.02 hdu1558 Segment set(并查集+计算几何)
传送门 这个直接用并查集维护。 每加入一条线段就将它与其他能相交的集合合并,维护一个sizesizesize域表示每个集合的大小。 代码:#include&lt;bits/stdc++.h&gt;#define eps 1e-15using namespace std;int t,fa[1005],n,siz[1005],cnt;struct pot{double x,y;}...原创 2018-08-02 11:52:03 · 146 阅读 · 0 评论 -
2018.07.06 POJ1556 The Doors(最短路)
The Doors Time Limit: 1000MS Memory Limit: 10000K Description You are to find the length of the shortest path through a chamber containing obstructing walls. The chamber will always have sid...原创 2018-07-06 10:23:28 · 146 阅读 · 0 评论 -
POJ 1265 Area(计算几何)
Area Time Limit: 1000MS Memory Limit: 10000K Description Being well known for its highly innovative products, Merck would definitely be a good target for industrial espionage. To protect its...原创 2018-07-04 22:47:02 · 126 阅读 · 0 评论 -
POJ 1696 Space Ant(凸包卷包裹)
Space Ant Time Limit: 1000MS Memory Limit: 10000K Description The most exciting space discovery occurred at the end of the 20th century. In 1999, scientists traced down an ant-like creature ...原创 2018-07-04 16:59:06 · 178 阅读 · 0 评论 -
POJ 1113 Wall(凸包)
Wall Time Limit: 1000MS Memory Limit: 10000K Description Once upon a time there was a greedy King who ordered his chief Architect to build a wall around the King’s castle. The King was so gr...原创 2018-07-04 16:22:00 · 262 阅读 · 0 评论 -
POJ 1654 Area(简单计算几何)
Area Time Limit: 1000MS Memory Limit: 10000K Description You are going to compute the area of a special kind of polygon. One vertex of the polygon is the origin of the orthogonal coordinate s...原创 2018-07-04 15:29:53 · 264 阅读 · 0 评论 -
POJ 3304 Segments(简单计算几何)
Segments Time Limit: 1000MS Memory Limit: 65536K Description Given n segments in the two dimensional space, write a program, which determines if there exists a line such that after projectin...原创 2018-07-04 14:44:48 · 157 阅读 · 0 评论 -
POJ 2398 Toy Storage(二分+简单计算几何)
Toy Storage Time Limit: 1000MS Memory Limit: 65536K Description Mom and dad have a problem: their child, Reza, never puts his toys away when he is finished playing with them. They gave Reza ...原创 2018-07-04 13:45:34 · 180 阅读 · 0 评论 -
BZOJ 2823: AHOI2012信号塔(最小圆覆盖)
2823: [AHOI2012]信号塔 Time Limit: 10 Sec Memory Limit: 128 MB Description 在野外训练中,为了确保每位参加集训的成员安全,实时的掌握和收集周边环境和队员信息非常重要,集训队采用的方式是在训练所在地散布N个小型传感器来收集并传递信息,这些传感器只与设在集训地中的信号塔进行通信,信号塔接收信号的覆盖范围是圆形,可以接收到所有分...原创 2018-07-04 11:50:34 · 206 阅读 · 0 评论 -
BZOJ1336&&1337: Balkan2002Alien最小圆覆盖
1336: [Balkan2002]Alien最小圆覆盖 Time Limit: 1 Sec Memory Limit: 162 MBSec Special Judge Description 给出N个点,让你画一个最小的包含所有点的圆。 Input 先给出点的个数N,2&amp;lt;=N&amp;lt;=100000,再给出坐标Xi,Yi.(-10000.0&amp;lt;=xi,yi&amp;lt;=1000...原创 2018-07-04 11:32:01 · 195 阅读 · 0 评论 -
BZOJ 2618 Cqoi2006凸多边形(半平面交)
2618: [Cqoi2006]凸多边形 Time Limit: 5 Sec Memory Limit: 128 MB Description 逆时针给出n个凸多边形的顶点坐标,求它们交的面积。例如n=2时,两个凸多边形如下图: 则相交部分的面积为5.233。 Input 第一行有一个整数n,表示凸多边形的个数,以下依次描述各个多边形。第i个多边形的第一行包含一个整数mi,表示多...原创 2018-07-04 10:33:41 · 161 阅读 · 0 评论 -
POJ 1279Art Gallery(半平面交)
Art Gallery Time Limit: 1000MS Memory Limit: 10000K Description The art galleries of the new and very futuristic building of the Center for Balkan Cooperation have the form of polygons (not ...原创 2018-07-03 23:35:35 · 206 阅读 · 0 评论 -
BZOJ 1007: [HNOI2008]水平可见直线(简单计算几何)
1007: [HNOI2008]水平可见直线 Time Limit: 1 Sec Memory Limit: 162 MB Description 在xoy直角坐标平面上有n条直线L1,L2,…Ln,若在y值为正无穷大处往下看,能见到Li的某个子线段,则称Li为可见的,否则Li为被覆盖的. 例如,对于直线:L1:y=x; L2:y=-x; L3:y=0则L1和L2是可见的,L3是被覆...原创 2018-07-03 16:50:22 · 147 阅读 · 0 评论 -
POJ 2318 TOYS(二分+简单计算几何)
TOYS Time Limit: 2000MS Memory Limit: 65536K Description Calculate the number of toys that land in each bin of a partitioned toy box. Mom and dad have a problem - their child John never pu...原创 2018-07-03 15:50:10 · 184 阅读 · 0 评论 -
POJ 2653 Pick-up sticks(简单计算几何)
Pick-up sticks Time Limit: 3000MS Memory Limit: 65536K Description Stan has n sticks of various length. He throws them one at a time on the floor in a random way. After finishing throwing, S...原创 2018-07-03 14:10:42 · 198 阅读 · 0 评论 -
POJ 3348 Cows(凸包)
Cows Time Limit: 2000MS Memory Limit: 65536K Description Your friend to the south is interested in building fences and turning plowshares into swords. In order to help with his overseas adve...原创 2018-07-03 13:24:50 · 336 阅读 · 0 评论