题目链接   题意:给出n个矩形,求能覆盖所有矩形的最小的矩形的面积. 题解:对所有点求凸包,然后旋转卡壳,对没一条边求该边的最左最右和最上的三个点. 利用叉积面积求高,利用点积的性质求最左右点和长度,更新面积最小值即可. #include<iostream> #include<cstdio> #include<cmath> #include<algorithm> #define MAX 50010 using namespace std; struct P…
Triangle Time Limit: 3000MS   Memory Limit: 30000KB   64bit IO Format: %I64d & %I64u Submit Status Description English Vietnamese Given n distinct points on a plane, your task is to find the triangle that have the maximum area, whose vertices are from…
D - Beauty Contest Time Limit:3000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Status Description Bessie, Farmer John's prize cow, has just won first place in a bovine beauty contest, earning the title 'Miss Cow World'. As a r…
题目链接 二维凸包板子..有时间会补总结的. #include <cstdio> #include <cmath> #include <algorithm> using namespace std; const int MAXN = 10010; struct point{ double x, y; }p[MAXN]; int cmp1(const point a, const point b){ return a.x == b.x ? a.y < b.y : a…
传送门 首先这个矩形的一条边肯定在凸包上.那么可以求出凸包然后枚举边,用类似旋转卡壳的方法求出另外三条边的位置,也就是求出以它为底最上面最右边最左边的点的位置.离它最远的点可以用叉积求,最左最右的可以用点积求.顺便注意精度问题,因为很小的时候可能会输出-0.00000,所以特判一下,当坐标小于eps的时候强制它等于0就行了 //minamoto #include<bits/stdc++.h> #define fp(i,a,b) for(register int i=a,I=b+1;i<I…
题目链接 旋转卡壳模板题把. 有时间再补总结吧. #include <cstdio> #include <cmath> #include <algorithm> using namespace std; const int MAXN = 100010; struct point{ int x, y; }p[MAXN]; int operator * (point a, point b){ // a x b return a.x * b.y - b.x * a.y; }…
题目链接: 洛谷 P3187 [HNOI2007]最小矩形覆盖 BZOJ 1185: [HNOI2007]最小矩形覆盖 Description 给定一些点的坐标,要求求能够覆盖所有点的最小面积的矩形, 输出所求矩形的面积和四个顶点坐标 Input 第一行为一个整数n(3<=n<=50000) 从第2至第n+1行每行有两个浮点数,表示一个顶点的x和y坐标,不用科学计数法 Output 第一行为一个浮点数,表示所求矩形的面积(精确到小数点后5位), 接下来4行每行表示一个顶点坐标,要求第一行为y坐…
[BZOJ1185][HNOI2007]最小矩形覆盖(凸包,旋转卡壳) 题面 BZOJ 洛谷 题解 最小的矩形一定存在一条边在凸包上,那么枚举这条边,我们还差三个点,即距离当前边的最远点,以及做这条边的垂线的最靠左和最靠右的两个点. 最远点很容易求,叉积计算面积来比就好了. 那么剩下两个点呢? 比如说找右侧的那个点,我们假装当前枚举出来的这条边就是水平线,那么只要当前的点和下一个点的直线与\(x\)轴正半轴夹角小于\(90°\) 显然就往这个方向走.然后从水平线换到一般的情况,也就是和枚举的这条…
1185: [HNOI2007]最小矩形覆盖 Time Limit: 10 Sec  Memory Limit: 162 MBSec  Special JudgeSubmit: 1426  Solved: 648[Submit][Status][Discuss] Description Input   Output   Sample Input   Sample Output   HINT   Source 计算几何 vfleaking提供Spj #include<cstdio> #inclu…
1185: [HNOI2007]最小矩形覆盖 Time Limit: 10 Sec  Memory Limit: 162 MBSec  Special JudgeSubmit: 1945  Solved: 853[Submit][Status][Discuss] Description 题解 显然矩形一边一定在凸包一边上 旋转卡壳维护其他三条边经过的顶点 更新答案 这题1A欸嘿嘿 代码 //by 减维 #include<iostream> #include<cstdio> #inc…