题目链接:BZOJ 1069
#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
const int maxn=2000+10;
int N,top;
int L[maxn],R[maxn];
struct node{
double x,y;
}p[maxn],point,s[maxn];
double get_cross(node a,node b,node c){//get the cross product of vector ab and vector ac.
return (b.x-a.x)*(c.y-a.y)-(b.y-a.y)*(c.x-a.x);
}
double get_dis(node a,node b){
return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
}
void get_point(){//find the basic point.
int col=1; point=p[1];
for(int i=2;i<=N;i++){
if(p[i].y<point.y || (p[i].y==point.y && p[i].x<point.x)){
col=i; point=p[i];
}
}
swap(p[1],p[col]);
}
bool cmp(node a,node b){//sort these points by following the clockwise.
double t=get_cross(point,a,b);
if(t<0)return true;
if(t>0)return false;
double xx=get_dis(point,a),yy=get_dis(point,b);
return xx<yy;
}
void Graham(){//get the convex hull.
top=2; s[1]=p[1]; s[2]=p[2];
for(int i=3;i<=N;i++){
while(top>=1 && get_cross(s[top-1],s[top],p[i])>=0)top--;
s[++top]=p[i];
}
}
void find(){
s[top+1]=p[1];
double ans=0;
int a,b;
for(int x=1;x<=top;x++)
{
a=x%top+1;b=(x+2)%top+1;//because a and b have the monotonicity.
for(int y=x+2;y<=top;y++)
{
while(a%top+1!=y && get_cross(s[x],s[y],s[a+1])>get_cross(s[x],s[y],s[a]))
a=a%top+1;
while(b%top+1!=x && get_cross(s[x],s[b+1],s[y])>get_cross(s[x],s[b],s[y]))
b=b%top+1;
ans=max(ans,get_cross(s[x],s[y],s[a])+get_cross(s[x],s[b],s[y]));
}
}
printf("%.3lf\n",ans/2);
}
void input(){
scanf("%d",&N);
for(int i=1;i<=N;i++){
scanf("%lf%lf",&p[i].x,&p[i].y);
}
}
void solve(){
get_point();
sort(p+2,p+N+1,cmp);
Graham();
find();
}
int main(){
input();
solve();
return 0;
}