项目编号:bzoj-1069

项目等级:Safe

项目描述:

  戳这里

特殊收容措施:

  求凸包后在凸包上旋转卡壳。然而复杂度要求较低,故可直接枚举四边形的一条对角线,另两个顶点在凸包上随这条对角线的移动具有单调性,所以总复杂度O(n2)。

附录:

 #include <bits/stdc++.h>
#define range(i,c,o) for(register int i=(c);i<(o);++i)
#define dange(i,c,o) for(register int i=(c);i>(o);--i)
using namespace std; static const double eps=1e-; typedef pair<double,double> POINT;
#define x first
#define y second inline POINT operator+(const POINT&P,const POINT&Q)
{
return make_pair(P.x+Q.x,P.y+Q.y);
} inline POINT operator-(const POINT&P,const POINT&Q)
{
return make_pair(P.x-Q.x,P.y-Q.y);
} inline double dis(const POINT&P,const POINT&Q)
{
return sqrt(pow(P.x-Q.x,)+pow(P.y-Q.y,));
} inline double cross(const POINT&P,const POINT&Q)
{
return P.x*Q.y-P.y*Q.x;
} inline double area(
const POINT&O,const POINT&P,const POINT&Q
)
{
return 0.5*cross(P-O,Q-O);
} // 1 stand for LEFT and -1 stand for RIGHT
inline int turn(
const POINT&O,const POINT&P,const POINT&Q
)
{
double duct=area(O,P,Q);
return fabs(duct)<eps?:(duct>?:-);
} POINT P[];
inline bool cmp(const POINT&A,const POINT&B)
{
int dir=turn(P[],A,B);
return dir?dir>:dis(P[],A)>dis(P[],B);
} static int N,cnt=; inline int next(const int&x) {return x+==cnt?:x+;}
inline int&move(int&x) {return ++x==cnt?x=:x;} int main()
{
scanf("%d",&N);
range(i,,N) scanf("%lf%lf",&P[i].x,&P[i].y);
range(i,,N)
{
if(P[i].y==P[].y?P[i].x<P[].x:P[i].y<P[].y)
{
swap(P[i],P[]);
}
}
sort(P+,P+N,cmp);
range(i,,N)
{
for(;cnt>&&turn(P[cnt-],P[cnt-],P[i])<;--cnt);
P[cnt++]=P[i];
}
double ans=;
range(i,,cnt)
{
int L=next(i),j=next(L),R=next(j);
for(;next(j)!=i;move(j))
{
for(;next(L)!=j&&
area(P[i],P[next(L)],P[j])+eps>
area(P[i],P[ L ],P[j]);move(L)
);
for(j==R?move(R):
;next(R)!=i&&
area(P[j],P[next(R)],P[i])+eps>
area(P[j],P[ R ],P[i]);move(R)
);
ans=max(ans,area(P[i],P[L],P[j])+area(P[j],P[R],P[i]));
}
}
return printf("%.3lf\n",ans),;
}

SCP-bzoj-1069的更多相关文章

  1. BZOJ 1069 Luogu P4166 最大土地面积 (凸包)

    题目链接: (bzoj)https://www.lydsy.com/JudgeOnline/problem.php?id=1069 (luogu)https://www.luogu.org/probl ...

  2. 【BZOJ 1069】 凸包+旋转卡壳

    1069: [SCOI2007]最大土地面积 Description 在某块平面土地上有N个点,你可以选择其中的任意四个点,将这片土地围起来,当然,你希望这四个点围成的多边形面积最大. Input 第 ...

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

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

  4. BZOJ 1069 最大土地面积

    Description 在某块平面土地上有N个点,你可以选择其中的任意四个点,将这片土地围起来,当然,你希望这四个点围成的多边形面积最大. Input 第1行一个正整数N,接下来N行,每行2个数x,y ...

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

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

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

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

  7. bzoj 1069

    最开始想到的是枚举3个点,另一个点用卡壳的思想,但实际上可以只枚举两个点(对角线上的两个点),其余两个点用卡壳. /****************************************** ...

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

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

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

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

  10. 【BZOJ 1069】【SCOI 2007】最大土地面积 凸包+旋转卡壳

    因为凸壳上对踵点的单调性所以旋转卡壳线性绕一圈就可以啦啦啦--- 先求凸包,然后旋转卡壳记录$sum1$和$sum2$,最后统计答案就可以了 #include<cmath> #includ ...

随机推荐

  1. PHP curl_errno函数

    curl_errno — 返回最后一次的错误号 说明 int curl_errno ( resource $ch ) 返回最后一次cURL操作的错误号. 参数 ch 由 curl_init() 返回的 ...

  2. SSM + MySQL批量删除操作

    最近项目中有个购物车功能需要能够选中商品,然后批量删除的操作,也可以单个删除,其实代码很简单就能实现. 这里需要注意的就是你前端是怎么传值的,我这里采用的数组的形式,用 ‘,’隔开. 然后控制层代码如 ...

  3. window安装oracle和创建数据库

    原文地址: https://www.cnblogs.com/hoobey/p/6010804.html  #11g安装 https://www.cnblogs.com/qq1272850043/p/6 ...

  4. 2018-2019-2 20175105王鑫浩《Java程序设计》实验三 《敏捷开发与XP实践》

    实验三 <敏捷开发与XP实践> 实验报告封面 课程:Java程序设计 班级:1751班 姓名:王鑫浩 学号:20175105 指导教师:王鑫浩 实验日期:2019年4月29日 实验时间:- ...

  5. anti-nim 游戏

    游戏描述: 桌上有n堆石子,游戏双方轮流取石子,每次只能从一堆中取出任意数目的石子,不能不取,取走最后一个石子者失败. 结论: 先手必胜,当且仅当: ①.所有堆的石子数都为1,且游戏的SG值为0. ② ...

  6. DCloud-MUI-JS:相关摘录

    ylbtech-DCloud-MUI-JS:相关摘录 1.返回顶部 1.JS initFun: function() { var oldBack = mui.back; mui.back = func ...

  7. upc组队赛14 Communication【并查集+floyd /Tarjan】

    Communication 题目描述 The Ministry of Communication has an extremely wonderful message system, designed ...

  8. scrapy爬虫值Items

    Items有哪些知识? 1.声明 import scrapy class Product(scrapy.Item): name = scrapy.Field() price = scrapy.Fiel ...

  9. 方法Join()

    等待线程结束:jion() 谦让: yeild() 睡眠: sleep() jion和sleep和yeild之间有什么区别呢? 首先介绍一下jion(): 如果想让主线程等待子线程执行完毕之后再继续运 ...

  10. oracle使用时间戳

    TO_DATE ( '2019-12-05 00:00:00', 'yyyy-mm-dd hh24:mi:ss' ) AS UPDATE_DATE,