1 #include2 #include 3 #include 4 #include 5 using namespace std; 6 7 const int maxn=50000; 8 struct point 9 {10 int x,y;11 bool operator < (const point &a)const12 {13 return (x 1&&det(ch[m-2],ch[m-1],p[i])<=0) m--;41 ch[m++]=p[i];42 }43 int k=m;44 for(int i=n-2; i>=0; i--)45 {46 while(m>k&&det(ch[m-2],ch[m-1],p[i])<=0) m--;47 ch[m++]=p[i];48 }49 if(n>1) m--;50 return m;51 }52 53 int dia_rotating_calipers(int n)54 {55 int dia=0,q=1;56 for(int i=0; i det(ch[i],ch[i+1],ch[q]))59 {60 q=(q+1)%n;61 }62 dia=max(dia,max(dis(ch[i],ch[q]),dis(ch[i+1],ch[q+1])));63 }64 return dia;65 }66 67 int main()68 {69 int n,cn;70 scanf("%d",&n);71 for(int i=0; i