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…
题目链接 2Y,模版抄错了一点. #include <cstdio> #include <cstring> #include <string> #include <cmath> #include <algorithm> using namespace std; #define eps 1e-8 #define N 2001 struct point { double x,y; }p[N],pre[N],temp[N]; double a,b,c;…
/* poj 1474 Video Surveillance - 求多边形有没有核 */ #include <stdio.h> #include<math.h> const double eps=1e-8; const int N=103; struct point { double x,y; }dian[N]; inline bool mo_ee(double x,double y) { double ret=x-y; if(ret<0) ret=-ret; if(ret&…
链接:http://poj.org/problem?id=1474 Video Surveillance Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 3247   Accepted: 1440 Description A friend of yours has taken the job of security officer at the Star-Buy Company, a famous depart- ment…
半平面交求多边形的核,注意边是顺时针给出的 //卡精致死于是换(?)了一种求半平面交的方法-- #include<iostream> #include<cstdio> #include<algorithm> #include<cmath> using namespace std; const int N=505; int n,cas; const double eps=1e-8; struct dian { double x,y; dian(double X…
题链: http://poj.org/problem?id=1474 题解: 计算几何,半平面交 半平面交裸题,快要恶心死我啦... (了无数次之后,一怒之下把onleft改为onright,然后还加了一个去重,总算是过了...) 代码: #include<cmath> #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #define MAXN 15…
求多边形核的存在性,过了这题但是过不了另一题的,不知道是模板的问题还是什么,但是这个模板还是可以过绝大部分的题的... #pragma warning(disable:4996) #include <iostream> #include <cstring> #include <cstdio> #include <vector> #include <cmath> #include <string> #include <algori…
链接 半平面交的模板题,判断有没有核.: 注意一下最后的核可能为一条线,面积也是为0的,但却是有的. #include<iostream> #include <stdio.h> #include <math.h> #define eps 1e-8 using namespace std; ; int m; double r; int cCnt,curCnt;//此时cCnt为最终切割得到的多边形的顶点数.暂存顶点个数 struct point { double x,y;…
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$…
http://poj.org/problem?id=1279 顺时针给你一个多边形...求能看到所有点的面积...用半平面对所有边取交即可,模版题 这里的半平面交是O(n^2)的算法...比较逗比...暴力对每条线段做半平面交...要注意的地方写在注释里了...顺序写反了卡了我好久 /********************* Template ************************/ #include <set> #include <map> #include <…
第一道半平面交,只会写N^2. 将每条边化作一个不等式,ax+by+c>0,所以要固定顺序,方便求解. 半平面交其实就是对一系列的不等式组进行求解可行解. 如果某点在直线右侧,说明那个点在区域内,否则出现在左边,就可能会有交点,将交点求出加入. //#pragma comment(linker, "/STACK:16777216") //for c++ Compiler #include <stdio.h> #include <iostream> #inc…
Triathlon Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 4733   Accepted: 1166 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…
题目链接 回忆了一下,半平面交,整理了一下模版. #include <cstdio> #include <cstring> #include <string> #include <cmath> #include <algorithm> using namespace std; #define eps 1e-8 #define N 2001 struct point { double x,y; }p[N],temp[N],pre[N]; int n…
题意:求多边形的核的面积 套模板即可 #include <iostream> #include <cstdio> #include <cmath> #define eps 1e-18 using namespace std; const int MAXN = 1555; double a, b, c; int n, cnt; struct Point { double x, y; double operator ^(const Point &b) const {…
博客原文地址:http://blog.csdn.net/xuechelingxiao/article/details/40859973 这两天刷了POJ上几道半平面交,对半平面交有了初步的体会,感觉半平面交还是个挺有用的知识点. 半平面交主要是看的ZZY的国家队论文,他提出的是一种O(n×log(n))的排序增量法. 附论文地址: 算法合集之<半平面交的新算法及其有用价值>. POJ 3335 Rotating Scoreboard 题目大意: World finals 要開始了,比赛场地是一…
求半平面交的算法是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 &…
给出三个半平面交的裸题. 不会的上百度上谷(gu)歌(gou)一下. 毕竟学长的语文是体育老师教的.(卡格玩笑,别当真.) 这种东西明白就好,代码可以当模板. //poj1474 Video Surveillance //点集默认顺时针 //算法参考:http://www.cnblogs.com/huangxf/p/4067763.html #include<cstdio> #include<cmath> using namespace std; ; struct point{ d…
链接: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…
题目链接: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…
题目链接:POJ 2451 Problem Description Prince Remmarguts solved the CHESS puzzle successfully. As an award, Uyuw planned to hold a concert in a huge piazza named after its great designer Ihsnayish. The piazza in UDF - United Delta of Freedom's downtown wa…
uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1058 半平面交求面积最值.直接枚举C(20,8)的所有情况即可. 代码如下: #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> #include <…
按逆时针顺序给出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是最开始的多边…
题目链接 题意 : 求一个多边形的核的面积. 思路 : 半平面交求多边形的核,然后在求面积即可. #include <stdio.h> #include <string.h> #include <iostream> #include <math.h> using namespace std ; struct node { double x; double y ; } p[],temp[],newp[];//p是最开始的多边形的每个点,temp是中间过程中临时…
题目链接 题意 : 给你一个多边形,问你在多边形内部是否存在这样的点,使得这个点能够看到任何在多边形边界上的点. 思路 : 半平面交求多边形内核. 半平面交资料 关于求多边形内核的算法 什么是多边形的内核? 它是平面简单多边形的核是该多边形内部的一个点集,该点集中任意一点与多边形边界上一点的连线都处于这个多边形内部.就是一个在一个房子里面放一个摄像 头,能将所有的地方监视到的放摄像头的地点的集合即为多边形的核. 如上图,第一个图是有内核的,比如那个黑点,而第二个图就不存在内核了,无论点在哪里,总…
Triathlon Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 6912   Accepted: 1790 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…