#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<iomanip>
using namespace std;
typedef long double ld;
typedef pair<ld,ld> pt;
typedef vector<pt> poly;
ld memo[128][128][128];
poly p;
void out(pt p) {
cout<<"("<<p.first<<","<<p.second<<")";
}
void out(poly p) {
for (int i=0;i<p.size();i++) out(p[i]);
}
ld d(pt p1, pt p2, pt p3) {
if (fabs(p1.first-p2.first)<1e-10) return 1e10;
return (p3.first-p2.first)*(p1.second-p2.second)/(p1.first-p2.first)+p2.second-p3.second;
}
int orient(pt p1, pt p2, pt p3) {
ld x=(p2.first-p1.first)*(p3.second-p1.second)-(p3.first-p1.first)*(p2.second-p1.second);
if (fabs(x)<1e-10) return 0;
else if (x<0) return -1; else return 1;
}
ld convex() {
sort (p.begin(),p.end());
ld ans = 0;
vector<int> c;
c.push_back(0);
c.push_back(1);
for (int i=2;i<p.size();i++)
{
while (c.size()>=2 && orient(p[c[c.size()-2]],p[c.back()],p[i])>0)
c.pop_back();
c.push_back(i);
}
//cout<<"convex hull has "<<c.size()<<endl;
for (int i=0;i<c.size()-1;i++)
for (int j=c[i];j<c[i+1];j++) {
ld s = d(p[c[i]],p[c[i+1]],p[j]);
p[j].second += s;
ans=max(ans,s);
}
return ans;
}
ld doit(int lo, int hi, int n) {
if (n<=0 || n>=hi-lo) return 1e15;
if (n*2 >= hi-lo) return 0;
ld &r = memo[lo][hi][n];
if (r>=0) return r;
r=1e15;
if (n==1) {
if (p[hi-2].first == p[hi-1].first) return 0;
for (int k=lo;k<hi-1;k++)
{
ld ans = -1;
for (int i=lo;i<hi;i++)
ans = max(ans, d(p[k],p[k+1],p[i]));
r = min(r,ans);
}
}
else {
r = 1e15;
for (int k=lo+2;k<hi-1;k++)
r = min(r,max(doit(k,hi,n-1),doit(lo,k,1)));
}
return r;
}
int main() {
int n,k;
while(cin>>n>>k && n && k) {
p.resize(n);
for (int i=0;i<n;i++) cin>>p[i].first>>p[i].second;
for (int i=0;i<=n;i++) for (int j=0;j<=n;j++) for (int kk=0;kk<=k;kk++) memo[i][j][kk]=-1;
ld t = convex();
//out(p); cout<<" "<<t<<endl;
cout<<t<<" "<<setiosflags(ios::fixed)<<setprecision(3)<<t+doit(0,n,k)<<endl;
}
return 0;
}
|