裸凸包……直接上代码……
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstdio>
#include<vector>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
const int maxn=10000+10;
const double eps=1e-12;
int n,l,top=0;
double ans;
struct point{
double x,y;
}p[maxn];
point sta[maxn];
bool cmp(const point &a,const point &b){
return a.x<b.x||(a.x==b.x&&a.y<b.y);
}
int comp(double x){
return fabs(x)<eps?0:x>0?1:-1;
}
double crossx(point a,point b,point c){//ab x ac
return (b.x-a.x)*(c.y-a.y)-(c.x-a.x)*(b.y-a.y);
}
double cal(point a,point b){
return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
int main(){
while (~scanf("%d%d",&n,&l)){
for (int i=1;i<=n;++i)
scanf("%lf%lf",&p[i].x,&p[i].y);
memset(sta,0,sizeof(sta));
sort(p+1,p+1+n,cmp); top=0; ans=0;
sta[++top]=p[1]; sta[++top]=p[2];
for (int i=3;i<=n;++i){
while (top>1&&comp(crossx(sta[top-1],sta[top],p[i]))<0) top--;
sta[++top]=p[i];
}
int mid=top; sta[++top]=p[n]; sta[++top]=p[n-1];
for (int i=n-2;i>=1;i--){
while (top>mid&&comp(crossx(sta[top-1],sta[top],p[i]))<0) top--;
sta[++top]=p[i];
}
for (int i=2;i<=top;++i)
ans+=cal(sta[i],sta[i-1]);
//for (int i=1;i<=top;++i) printf("%lf %lf\n",sta[i].x,sta[i].y);
//ans+=cal(sta[1],sta[top]);
double Sy=2*l*3.1415926535; ans+=Sy;
printf("%.0f\n",ans);
}
}