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 ...
随机推荐
- 'PostBuildEvent' failed with error code '1' 'Unspecified error'( PostBuildEvent”失败,错误代码为“1”。“未指定的错误” )
这种错误很坑,2年前遇到一次,现在有遇到了(主要记不得上次怎么解决了的) 主要在于js文件文件修改保存的时候得以ansi格式保存,不能以utf-8 http://files.cnblogs.com/f ...
- 【转载】oracle索引详解
原文URL;http://www.oschina.net/question/30362_4057?fromerr=FiY27yLL 作者:crazyinsomnia 一. ROWID的概念 存储了ro ...
- oracle查询在当前数据库下当前用户拥有的表语句
1.查询表的数目: select count(*) from tabs select count(*) from user_tables 2.查询用户拥有哪些表: select * from tabs ...
- pl/sql中误删表中数据并提交恢复办法
最近在操作表中数据时,删除了表中数据,但是又想恢复,后来查到了官方的一篇文档,发现还蛮有用的,如下: 在pl/sql中运行,select * from A as of TIMESTAMP to_tim ...
- 简单的C#爬虫
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net ...
- OK335xS U-boot 环境变量解析
/************************************************************************************************** ...
- 打乱一个文件 shuf
$ shuf --help 用法: shuf [选项]... [文件] 或者: shuf -e [选项]... [参数]... 或者: shuf -i LO-HI [选项]... 把输入行按随机顺序输 ...
- HDU 1010:Tempter of the Bone(DFS+奇偶剪枝+回溯)
Tempter of the Bone Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Othe ...
- long long 与 int
- hdu1166 敌兵布阵 树状数组/线段树
数列的单点修改.区间求和 树状数组或线段树入门题 #include<stdio.h> #include<string.h> ],N; void add(int x,int a) ...