Description The main land of Japan called Honshu is an island surrounded by the sea. In such an island, it is natural to ask a question: “Where is the most distant point from the sea?” The answer to this question for Honshu was found in 1996. The mos…
http://poj.org/problem?id=3525 给出一个凸包,要求凸包内距离所有边的长度的最小值最大的是哪个 思路:二分答案,然后把凸包上的边移动这个距离,做半平面交看是否有解. #include<cstdio> #include<iostream> #include<cmath> #include<cstring> #include<algorithm> const double finf=1e10; ; ); int n,tot…
Most Distant Point from the Sea Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 5153   Accepted: 2326   Special Judge Description The main land of Japan called Honshu is an island surrounded by the sea. In such an island, it is natural t…
Most Distant Point from the Sea Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 3476   Accepted: 1596   Special Judge Description The main land of Japan called Honshu is an island surrounded by the sea. In such an island, it is natural t…
Description The main land of Japan called Honshu is an island surrounded by the sea. In such an island, it is natural to ask a question: “Where is the most distant point from the sea?” The answer to this question for Honshu was found in 1996. The mos…
Most Distant Point from the Sea Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 3955   Accepted: 1847   Special Judge Description The main land of Japan called Honshu is an island surrounded by the sea. In such an island, it is natural t…
按逆时针顺序给出n个点,求它们组成的多边形的最大内切圆半径. 二分这个半径,将所有直线向多边形中心平移r距离,如果半平面交不存在那么r大了,否则r小了. 平移直线就是对于向量ab,因为是逆时针的,向中心平移就是向向量左手边平移,求出长度为r方向指向向量左手边的向量p,a+p指向b+p就是平移后的向量. 半平面交就是对于每个半平面ax+by+c>0,将当前数组里的点(一开始是所有点)带入,如果满足条件,那么保留该点,否则,先看i-1号点是否满足条件,如果满足,那么将i-1和i点所在直线和直线ax+…
题目链接 题意 : 给你一个多边形,问你里边能够盛的下的最大的圆的半径是多少. 思路 :先二分半径r,半平面交向内推进r.模板题 #include <stdio.h> #include <string.h> #include <iostream> #include <math.h> ; using namespace std ; struct node { double x; double y ; } p[],temp[],newp[];//p是最开始的多边…
题目就是求多变形内部一点. 使得到任意边距离中的最小值最大. 那么我们想一下,可以发现其实求是看一个圆是否能放进这个多边形中. 那么我们就二分这个半径r,然后将多边形的每条边都往内退r距离. 求半平面交看是否存在解即可 #include <iostream> #include <cstdio> #include <cstring> #include <string> #include <algorithm> #include <cstdli…
相当于多边形内最大圆,二分半径r,然后把每条边内收r,求是否有半平面交(即是否合法) #include<iostream> #include<cstdio> #include<algorithm> #include<cmath> using namespace std; const int N=205; const double eps=1e-6; int n; struct dian { double x,y; dian(double X=0,double…
题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=11358 [思路] 二分法+半平面交 二分与海边的的距离,由法向量可以得到平移后的各边,半平面交在特定精度判断是否有交集. [代码] #include<cmath> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; ; stru…
pro:给定凸多边形,求凸多边形内的点到最近边界的最远距离. sol:显然是二分一个圆,使得圆和凸多边形不相交,但是这样很难实现. 由于是凸多边形,我们可以把二分圆转化为二分凸多边形的移动. 如果每一边向左移动Mid后,任然存在“核”,则表示存在一点合法. 直线移动:移动起点即可,方向不变. #include<bits/stdc++.h> #define ll long long #define rep(i,a,b) for(int i=a;i<=b;i++) using namespa…
题目链接 题意 : 给你一个多边形,问你该多边形中是否存在一个点使得该点与该多边形任意一点的连线都在多边形之内. 思路 : 与3335一样,不过要注意方向变化一下. #include <stdio.h> #include <string.h> #include <iostream> #include <math.h> using namespace std ; struct node { double x; double y ; } p[],temp[],n…
求多边形的核,直接把所有边求半平面交判断有无即可 #include<iostream> #include<cstdio> #include<algorithm> #include<cmath> using namespace std; const int N=205; const double eps=1e-6; int n; struct dian { double x,y; dian(double X=0,double Y=0) { x=X,y=Y; }…
Most Distant Point from the Sea [题目链接]Most Distant Point from the Sea [题目类型]半平面交 &题解: 蓝书279 二分答案,判断平移后的直线的半平面交是否为空. 模板是照着敲的,还有一些地方不是很懂, 应该还要慢慢体会吧 &代码: #include <cstdio> #include <cmath> #include <algorithm> #include <vector>…
二分+计算几何/半平面交 半平面交的学习戳这里:http://blog.csdn.net/accry/article/details/6070621 然而这题是要二分长度r……用每条直线的距离为r的平行线来截“凸包” 做平行线的方法是:对于向量(x,y),与它垂直的向量有:(y,-x)和(-y,x),然后再转化成单位向量,再乘以 r ,就得到了转移向量tmp,设直线上两点为A(x1,y1),B(x2,y2),用这个方法就找到了直线AB的平行线CD,其中C=A+tmp,D=b+tmp; 然而我傻逼…
Most Distant Point from the Sea Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 4758   Accepted: 2178   Special Judge Description The main land of Japan called Honshu is an island surrounded by the sea. In such an island, it is natural t…
Most Distant Point from the Sea Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 3640   Accepted: 1683   Special Judge Description The main land of Japan called Honshu is an island surrounded by the sea. In such an island, it is natural t…
多边形内最大半径圆. 哇没有枉费了我自闭了这么些天,大概五天前我看到这种题可能毫无思路抓耳挠腮举手投降什么的,现在已经能1A了哇. 还是先玩一会计算几何,刷个几百道 嗯这个半平面交+二分就阔以解决.虽然队友说他施展三分套三分***** 想象一下,如果一个多边形能放进去半径为r的圆,那么在每条边向里平移r之后,他的内核一定不为空. 所以我们可以二分r,然后求半平面交,平移操作其实很好处理. 1A了很开森,去快乐的玩耍惹. #include <iostream> #include <cstd…
题目描述: vjudge POJ 题解: 二分答案+半平面交. 半径范围在0到5000之间二分,每次取$mid$然后平移所有直线,判断半平面交面积是否为零. 我的eps值取的是$10^{-12}$,36ms,而且和样例一样. (大力推荐) 代码: #include<cmath> #include<vector> #include<cstdio> #include<cstring> #include<algorithm> using namespa…
链接:http://poj.org/problem?id=3335     //大牛们常说的测模板题 ---------------------------------------------------------------- Rotating Scoreboard Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 5158   Accepted: 2061 Description This year, ACM/ICPC…
Triathlon Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 6461   Accepted: 1643 Description Triathlon is an athletic contest consisting of three consecutive sections that should be completed as fast as possible as a whole. The first sect…
Art Gallery Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 6668   Accepted: 2725 Description The art galleries of the new and very futuristic building of the Center for Balkan Cooperation have the form of polygons (not necessarily conve…
Rotating Scoreboard Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 6420   Accepted: 2550 Description This year, ACM/ICPC World finals will be held in a hall in form of a simple polygon. The coaches and spectators are seated along the ed…
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 necessarily convex). When a big exhibition is organized, wat…
LINK 题意:给出一个多边形,求是否存在核. 思路:比较裸的题,要注意的是求系数和交点时的x和y坐标不要搞混...判断核的顶点数是否大于1就行了 /** @Date : 2017-07-20 19:55:49 * @FileName: POJ 3335 半平面交求核.cpp * @Platform: Windows * @Author : Lweleth (SoungEarlf@gmail.com) * @Link : https://github.com/ * @Version : $Id$…
求半平面交的算法是zzy大神的排序增量法. ///Poj 1474 #include <cmath> #include <algorithm> #include <cstdio> using namespace std; ; //点 class Point { public: double x, y; Point(){} Point(double x, double y):x(x),y(y){} bool operator < (const Point &…
http://poj.org/problem?id=1474 解法同POJ 1279 A一送一 缺点是还是O(n^2) ...nlogn的过几天补上... /********************* Template ************************/ #include <set> #include <map> #include <list> #include <cmath> #include <ctime> #include…
http://poj.org/problem?id=1279 顺时针给你一个多边形...求能看到所有点的面积...用半平面对所有边取交即可,模版题 这里的半平面交是O(n^2)的算法...比较逗比...暴力对每条线段做半平面交...要注意的地方写在注释里了...顺序写反了卡了我好久 /********************* Template ************************/ #include <set> #include <map> #include <…
题目链接:POJ 3130 Problem Description After counting so many stars in the sky in his childhood, Isaac, now an astronomer and a mathematician uses a big astronomical telescope and lets his image processing program count stars. The hardest part of the prog…