bzoj4232: [Neerc2011 Northern]Kids Like Cakes
Description
Input
Output
#include<bits/stdc++.h>
typedef long long i64;
struct pos{int x,y;}ps[];
pos operator+(pos a,pos b){return (pos){a.x+b.x,a.y+b.y};}
pos operator-(pos a,pos b){return (pos){a.x-b.x,a.y-b.y};}
i64 operator*(pos a,pos b){return i64(a.x)*b.y-i64(a.y)*b.x;}
int n,ws[];
i64 ans=,s0[],ms[];
void maxs(i64&a,i64 b){if(a<b)a=b;}
int main(){
scanf("%d",&n);
for(int i=;i<=n;++i)scanf("%d%d",&ps[i].x,&ps[i].y);
if((ps[]-ps[])*(ps[]-ps[])<)std::reverse(ps+,ps+n+);
ps[n*+]=ps[];
ps[]=ps[n];
for(int i=;i<=n;++i)ps[n+i]=ps[i],ws[i]=i;
for(int d=;d<n;++d){
for(int l=,r=d;l<=n;++l,++r){
pos a=ps[r]-ps[l];
s0[l]=(ps[ws[l]]-ps[l])*a;
while(ws[l]+<r){
i64 s1=(ps[ws[l]+]-ps[l])*a;
if(s1<s0[l])break;
++ws[l];
s0[l]=s1;
}
maxs(ms[l],s0[l]);
}
ms[n+]=ms[];
for(int l=;l<=n;++l)maxs(ms[l],ms[l+]);
}
for(int l=,r=n-;l<=n;++l,++r)maxs(ans,ms[l]-(ps[r]-ps[l])*(ps[r+]-ps[l]));
printf("%lld.%lld\n",ans/,ans%*);
return ;
}
bzoj4232: [Neerc2011 Northern]Kids Like Cakes的更多相关文章
- bzoj AC倒序
Search GO 说明:输入题号直接进入相应题目,如需搜索含数字的题目,请在关键词前加单引号 Problem ID Title Source AC Submit Y 1000 A+B Problem ...
- 2632: [neerc2011]Gcd guessing game
2632: [neerc2011]Gcd guessing game Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 144 Solved: 84[S ...
- 【2015-2016 ACM-ICPC, NEERC, Northern Subregional Contest D】---暑假三校训练
2015-2016 ACM-ICPC, NEERC, Northern Subregional Contest D Problem D. Distribution in Metagonia Input ...
- SGU 495. Kids and Prizes
水概率....SGU里难得的水题.... 495. Kids and Prizes Time limit per test: 0.5 second(s)Memory limit: 262144 kil ...
- Kids and Prizes(SGU 495)
495. Kids and Prizes Time limit per test: 0.25 second(s)Memory limit: 262144 kilobytes input: standa ...
- sgu 495. Kids and Prizes (简单概率dp 正推求期望)
题目链接 495. Kids and Prizes Time limit per test: 0.25 second(s)Memory limit: 262144 kilobytes input: s ...
- 495. Kids and Prizes
http://acm.sgu.ru/problem.php?contest=0&problem=495 学习:当一条路走不通,换一种对象考虑,还有考虑对立面. 495. Kids and Pr ...
- northern truck 是什么牌子?具体_百度知道
northern truck 是什么牌子?具体_百度知道 northern truck 是什么牌子?具体
- SGU 495. Kids and Prizes( 数学期望 )
题意: N个礼品箱, 每个礼品箱内的礼品只有第一个抽到的人能拿到. M个小孩每个人依次随机抽取一个, 求送出礼品数量的期望值. 1 ≤ N, M ≤ 100, 000 挺水的说..设f(x)表示前x ...
随机推荐
- Windows下使用Nexus搭建pypi私服
Nexus之前一直作为maven的私服而被大家所熟知,但是其实nexus可以做很多种仓库的私服,官网的说明就揭示了一切,真是又方便又强大的开源工具. 首先下载安装nexus,地址: https://w ...
- flash存储原理
norflash 带有 SRAM接口,有足够的地址引脚来寻址,可以很容易地存取其内容每一字节:nandflash器件使用复杂的IO口串行的存取数据,读写操作采用512字节的块(也就是读/写某个字节,必 ...
- Objective-C和Swift混合编程开发
创建混编的Framework工程 第一步:创建target为Framework的工程 打开Xcode6-Beta,菜单栏File—>New—>Project; 创建一个新的工程,工程模板选 ...
- asp.net webform 当前上下文中不存在名称“__o”
错误 CS0103 当前上下文中不存在名称“__o” 最近在搞一个webform项目, 再页面写了点<%%>代码, 结果编译下居然出现了这个错误 炸裂啊, 这是什么毛线, 看起来是 In ...
- python3 线性同余发生器 ( random 随机数生成器 ) 伪随机数产生周期的一些探究
import random x=[str(random.randint(0, 5)) for i in range(10)] x_str=''.join(x) y=[str(random.randin ...
- explain结果字段说明
Explain命令在解决数据库性能上是第一推荐使用命令,大部分的性能问题可以通过此命令来简单的解决,Explain可以用来查看SQL语句的执行效 果,可以帮助选择更好的索引和优化查询语句,写出更好的优 ...
- openLayers 4 canvas图例绘制,canvas循环添加图片,解决图片闪烁问题
一.问题来源: 接触Openlayers 一段时间了,最近做了一个农业产业系统,项目中涉及到产业图例,最后考虑用canvas来绘制图例图像.当中带图片的图例移动时,图片会实现闪烁留白情况.闪烁是因为绘 ...
- 51Nod:活动安排问题(区间问题)
X轴上有N条线段,每条线段有1个起点S和终点E.最多能够选出多少条互不重叠的线段.(注:起点或终点重叠,不算重叠). 例如:[1 5][2 3][3 6],可以选[2 3][3 6],这2条线段互不重 ...
- 《DSP using MATLAB》Problem 4.11
代码: %% ---------------------------------------------------------------------------- %% Output Info a ...
- ppt正文排版