枚举对角线,然后旋转卡壳即可。

#include <map>
#include <cmath>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define F(i,j,k) for (int i=j;i<=k;++i)
#define D(i,j,k) for (int i=j;i>=k;--i)
#define eps 1e-8
#define ll long long
#define mp make_pair struct Vector{
double x,y;
void print()
{
printf("Vector -> (%.3f,%.3f)\n",x,y);
}
}; struct Point{
double x,y;
void print()
{
printf("Point (%.3f,%.3f)\n",x,y);
}
}; double operator * (Vector a,Vector b)
{return a.x*b.y-a.y*b.x;} Vector operator - (Point a,Point b)
{Vector ret;ret.x=a.x-b.x;ret.y=a.y-b.y;return ret;} int n,top=0;
Point p[2005],sta[2005]; bool cmp(Point a,Point b)
{return fabs(a.x-b.x)<eps?a.y<b.y:a.x<b.x;} void Andrew()
{
sta[++top]=p[1];
F(i,2,n)
{
while (top>=2&&(sta[top]-sta[top-1])*(p[i]-sta[top])<eps) top--;
sta[++top]=p[i];
}
int lower=top;
D(i,n-1,1)
{
while (top-lower>=1&&(sta[top]-sta[top-1])*(p[i]-sta[top])<eps) top--;
sta[++top]=p[i];
}
// printf("In the outside :\n");
// F(i,1,top) sta[i].print();
} double ans=0; void Rotating()
{
F(x,1,top-2)
{
int a=x%top+1,b=(x+2)%top+1;
F(y,x+2,top-1)
{
while (a%top+1!=y&&(sta[a+1]-sta[x])*(sta[y]-sta[x])>(sta[a]-sta[x])*(sta[y]-sta[x])) a=a%top+1;
while (b%top+1!=x&&(sta[y]-sta[x])*(sta[b+1]-sta[x])>(sta[y]-sta[x])*(sta[b]-sta[x])) b=b%top+1;
ans=max(ans,(sta[a]-sta[x])*(sta[y]-sta[x])+(sta[y]-sta[x])*(sta[b]-sta[x]));
}
}
} int main()
{
// freopen("in.txt","r",stdin);
scanf("%d",&n);
F(i,1,n) scanf("%lf%lf",&p[i].x,&p[i].y);
sort(p+1,p+n+1,cmp);
Andrew();
Rotating();
printf("%.3f\n",ans/2.0);
}

  

BZOJ 1069 [SCOI2007]最大土地面积 ——计算几何的更多相关文章

  1. BZOJ 1069: [SCOI2007]最大土地面积(旋转卡壳)

    题目链接~ 1069: [SCOI2007]最大土地面积 思路很简单,极角排序求完凸包后,在凸包上枚举对角线,然后两边分别来两个点旋转卡壳一下,搞定! 不过计算几何的题目就是这样,程序中间的处理还是比 ...

  2. bzoj 1069 [SCOI2007]最大土地面积(旋转卡壳)

    1069: [SCOI2007]最大土地面积 Time Limit: 1 Sec  Memory Limit: 162 MBSubmit: 2277  Solved: 853[Submit][Stat ...

  3. BZOJ 1069: [SCOI2007]最大土地面积 [旋转卡壳]

    1069: [SCOI2007]最大土地面积 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 2978  Solved: 1173[Submit][Sta ...

  4. ●BZOJ 1069 [SCOI2007]最大土地面积

    题链: http://www.lydsy.com/JudgeOnline/problem.php?id=1069 题解: 计算几何,凸包,旋转卡壳 其实和这个题差不多,POJ 2079 Triangl ...

  5. bzoj 1069 [SCOI2007]最大土地面积——旋转卡壳

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1069 发现 n 可以 n^2 .所以枚举对角线,分开的两部分三角形就可以旋转卡壳了. 注意坐 ...

  6. [BZOJ]1069: [SCOI2007]最大土地面积

    题目大意:给出二维平面上n个点,求最大的由这些点组成的四边形面积.(n<=2000) 思路:求出凸包后旋转卡壳枚举对踵点对作为四边形的对角线,枚举或二分另外两个点,复杂度O(n^2)或O(nlo ...

  7. bzoj 1069: [SCOI2007]最大土地面积 凸包+旋转卡壳

    题目大意: 二维平面有N个点,选择其中的任意四个点使这四个点围成的多边形面积最大 题解: 很容易发现这四个点一定在凸包上 所以我们枚举一条边再旋转卡壳确定另外的两个点即可 旋(xuan2)转(zhua ...

  8. 1069: [SCOI2007]最大土地面积

    1069: [SCOI2007]最大土地面积 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 2961  Solved: 1162[Submit][Sta ...

  9. 【BZOJ】1069: [SCOI2007]最大土地面积(凸包+旋转卡壳)

    http://www.lydsy.com/JudgeOnline/problem.php?id=1069 显然这四个点在凸包上,然后枚举两个点找上下最大的三角形即可. 找三角形表示只想到三分QAQ.. ...

随机推荐

  1. jmeter动态参数传值配置

    jmeter动态参数传值配置

  2. Python 学习日志9月20日

    9月20日 周三 多大年龄了,还活得像个小孩.——急什么,人生又不长. 你习惯了思考宇宙星辰,一百年真的不长,一生也就不那么长,许多人的价值观念你也就无法理解.同样,许多人也无法理解你的价值观念,感兴 ...

  3. Educational Codeforces Round 11 C hard process_补题——作为司老大的脑残粉

    司老大当时教了一种姿势枚举连续K个0,说实话当时比赛写这题完全蒙了 纵然后来知道思路还是写了一段时间 真的是.. 题目大意 n长度的序列,由0 1构成 我们可以改变 k个0为1 求可以得到的最长连续1 ...

  4. leetcode_1095. Find in Mountain Array_[Binary Search]

    https://leetcode.com/problems/find-in-mountain-array/ 题意:给定一个MountainArray(定义见题目),找到其中最早出现的target值的下 ...

  5. 签名ipa,让其它手机也安装

    开发的时候,需要将app让其它人装上测试,虽然通过xcode可以使用编译进去,但是仍显不方便. 网上有个工具, http://code.google.com/p/iresign/ 通过这个工具,使用自 ...

  6. Codeforces Round #271 (Div. 2)-A. Keyboard

    http://codeforces.com/problemset/problem/474/A A. Keyboard time limit per test 2 seconds memory limi ...

  7. 如何正确入门Windows系统下驱动开发领域?

    [作者]猪头三个人网站 :http://www.x86asm.com/ [序言]很多人都对驱动开发有兴趣,但往往找不到正确的学习方式.当然这跟驱动开发的本土化资料少有关系.大多学的驱动开发资料都以英文 ...

  8. 【树形dp 最长链】bzoj1912: [Apio2010]patrol 巡逻

    富有思维性的树形dp Description Input 第一行包含两个整数 n, K(1 ≤ K ≤ 2).接下来 n – 1行,每行两个整数 a, b, 表示村庄a与b之间有一条道路(1 ≤ a, ...

  9. NOIP 2017 D2T1 奶酪

    #include<iostream> #include<cstdio> #include<cstdlib> #include<algorithm> #i ...

  10. RN安卓原生模块

    https://facebook.github.io/react-native/docs/native-modules-android.html RN实际就是依附在原生平台上,把各种各样的RN组件展示 ...