Problem:
G: 塗るだけ / Paint
問題文
情太くんと立子さんは，
平面の世界にある庭付きの家に住んでいる．二人は点とみなせ，
庭は $N$ 頂点の単純多角形 (隣り合わないどの $2$ 辺も交差も接触もしない多角形) の形をしている．
ある日，二人は一本の伸び縮みするローラーを手に入れた．
ローラーは線分とみなせ，ローラーが通過した領域に色を塗ることができる．
二人はローラーを使って庭全体に色を塗りたいと思っている．
作業の前に，二人は以下のような準備を上から順に行う．
庭の内部の任意の $1$ 箇所に杭を打つ．
庭の外部のある $1$ 点に集まる．
十分に長い紐を用意し，片方の端を情太くん，もう一方の端を立子さんの体に結ぶ．
情太くんがローラーの片方の端を，立子さんがもう一方の端を持つ．
準備ができたら，以下のルールに従って塗り始める．
ただし，ローラーは杭の上空を通過させることができるが，紐はできない．
庭のどの部分から塗り始めてもよい．
庭の外部または周上を移動できるが，内部に入ってはいけない．
塗り終わるまでローラーから手を離してはいけない．
さらに，塗り終わったときに以下の条件を満たしていなければならない．
二人が再びある $1$ 点に集まっている．
庭の内部の任意の点の上をローラーが通過している．
二人の体の紐を解き，両端を結んで輪を作る．この輪を外から引っ張ったときに，杭に引っかかって抜けない．
さて，二人はできるだけ離れたくないので，塗っている最中にとる二人の距離の最大値を最小化したい．
二人に代わってそのような値を求めてほしい．
入力
入力は以下の形式で与えられる．$N$ は多角形を構成する頂点の数，
$(x_i,y_i)$ はある頂点から始めて時計回りまたは反時計回りに見たときの $i$ 番目の点の座標である．
$N$
$x_1 \ y_1$
$\vdots$
$x_N \ y_N$
制約
$3 \leq N \leq 50$
$|x_i|, |y_i| \leq 100$
全て整数である
頂点は時計回りまたは反時計回りに与えられる
庭の形は単純多角形である
周上の連続する $3$ 点は一直線上に存在しない
出力
答えを $1$ 行で出力せよ．$10^{-5}$ 未満の絶対誤差は許容される．
サンプル
各サンプルでの庭の形と塗り終わるまでのローラーの動きを図示すると以下のようになる．整数は時刻を表す．図示する都合上ローラーの動きは飛び飛びに示したが,実際には連続的に動いている．
ローラーが太くなっている部分で距離の最大値を達成している．
サンプル入力1
4
0 0
0 1
1 1
1 0
サンプル出力1
1
サンプル入力2
3
0 0
0 1
1 0
サンプル出力2
0.7071067811865476
サンプル入力3
8
0 0
5 0
5 3
0 3
0 2
4 2
4 1
0 1
サンプル出力3
1.4142135623730951

Submitted solutions:

code_snippet: #include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <algorithm>
#include <bitset>
#include <complex>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include <cassert>
#include <functional>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(...) ;
#else
#define debug(...) cerr << __LINE__ << " : " << #__VA_ARGS__ << " = " << _tostr(__VA_ARGS__) << endl;

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v);

template<typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}

void _tostr_rec(ostringstream &oss) {
  oss << "\b\b \b";
}

template<typename Head, typename... Tail>
void _tostr_rec(ostringstream &oss, Head &&head, Tail &&... tail) {
  oss << head << ", ";
  _tostr_rec(oss, forward<Tail>(tail)...);
}

template<typename... T>
string _tostr(T &&... args) {
  ostringstream oss;
  int size = sizeof...(args);
  if (size > 1) oss << "{";
  _tostr_rec(oss, forward<T>(args)...);
  if (size > 1) oss << "}";
  return oss.str();
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010

typedef double P_type; //座標(integer or real)
typedef double G_real; //実数の戻り値(float or double or long double)
typedef complex<P_type> P;
const G_real P_eps = 1e-8; //整数の時はゼロ

namespace std {
  template<class T>
  bool operator<(const complex<T> &a, const complex<T> &b) {
    return abs(a.real() - b.real()) < P_eps ? a.imag() + P_eps < b.imag() : a.real() + P_eps < b.real();
  }
};

P rotate(P p, double theta) {
  return p * P(cos(theta), sin(theta));
}

//内積
P_type dot(P a, P b) {
  return (a * conj(b)).real();
}

//外積
P_type cross(P a, P b) {
  return (conj(a) * b).imag();
}

//反時計回り
int ccw(P a, P b, P c) {
  if (cross(b - a, c - a) > P_eps) return 1; //COUNTER_CLOCKWISE(center:a)
  if (cross(b - a, c - a) < -P_eps) return -1; //CLOCKWISE(center:a)
  if (dot(b - a, c - a) < -P_eps) return -2; //c -> a -> b
  if (dot(a - b, c - b) < -P_eps) return 2; //a -> b -> c
  return 0; //a -> c -> b
}

/* 線分交差判定 */
bool isIntersectedSS(P a1, P a2, P b1, P b2) {
  //線分a と 直線b
  int a = ccw(b1, b2, a1);
  int b = ccw(b1, b2, a2);

  //線分b と 直線a
  int c = ccw(a1, a2, b1);
  int d = ccw(a1, a2, b2);

  return a * b <= 0 && c * d <= 0; // T字を除く時は (** < 0)
}

/* 射影(直線abとpからの垂線との交点) */
P getProject(P a, P b, P p) {
  P base = b - a;
  return a + base * dot(p - a, base) / norm(base);
}

void chmin(double &a, double b) {
  if (a > b) { a = b; }
}

double solve(vector<P> a) {
  const int n = a.size();
  for (int i = 0; i < n; i++) a.push_back(a[i]);
  vector<vector<double>> dp(n * 2, vector<double>(n * 2, INFINITY));
  for (int i = 0; i < n * 2; i++) dp[i][i] = 0;
  for (int d = 0; d < n; d++) {
    for (int i = 0; i + d < n * 2; i++) {
      const int j = i + d;
      if (i) {
        chmin(dp[i - 1][j], max<double>(dp[i][j], abs(a[i - 1] - a[j])));
      }
      if (j + 1 < n * 2) {
        chmin(dp[i][j + 1], max<double>(dp[i][j], abs(a[i] - a[j + 1])));
      }
      if (i && j + 1 < n * 2) {
        chmin(dp[i - 1][j + 1], max<double>(dp[i][j], abs(a[i - 1] - a[j + 1])));
      }
    }
  }
  double ans = INFINITY;
  for (int i = 0; i < n; i++) chmin(ans, dp[i][i + n]);
  return ans;
}

int main() {
  int N;
  vector<P> poly;

  scanf("%d", &N);

  for (int i = 0; i < N; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    poly.push_back(P(x, y));
  }

  vector<P> vec;

  for (int i = 0; i < N; i++) {
    P s = poly[i], t = poly[(i + 1) % N];

    vector<pair<G_real, P>> temp;

    for (int j = 0; j < N; j++) {
      if (j == i || (i + 1) % N == j) continue;

      auto proj = getProject(s, t, poly[j]);

      if (abs(s - proj) > P_eps && abs(t - proj) > P_eps && isIntersectedSS(s, t, poly[j], proj)) {
        temp.push_back({abs(s - proj), proj});
      }
    }

    sort(temp.begin(), temp.end());

    vec.push_back(s);
    for (auto v : temp) vec.push_back(v.second);
  }

  debug(vec);

  double ans = solve(vec);

  printf("%.10lf\n", ans);

  return 0;
}
accuracy: 0.08571428571428572
time_ms: 70
memory_kb: 40080
final_rank: 6

code_snippet: #include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <algorithm>
#include <bitset>
#include <complex>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include <cassert>
#include <functional>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(...) ;
#else
#define debug(...) cerr << __LINE__ << " : " << #__VA_ARGS__ << " = " << _tostr(__VA_ARGS__) << endl;

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v);

template<typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}

void _tostr_rec(ostringstream &oss) {
  oss << "\b\b \b";
}

template<typename Head, typename... Tail>
void _tostr_rec(ostringstream &oss, Head &&head, Tail &&... tail) {
  oss << head << ", ";
  _tostr_rec(oss, forward<Tail>(tail)...);
}

template<typename... T>
string _tostr(T &&... args) {
  ostringstream oss;
  int size = sizeof...(args);
  if (size > 1) oss << "{";
  _tostr_rec(oss, forward<T>(args)...);
  if (size > 1) oss << "}";
  return oss.str();
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010

typedef double P_type; //座標(integer or real)
typedef double G_real; //実数の戻り値(float or double or long double)
typedef complex<P_type> P;
const G_real P_eps = 1e-8; //整数の時はゼロ

namespace std {
  template<class T>
  bool operator<(const complex<T> &a, const complex<T> &b) {
    return abs(a.real() - b.real()) < P_eps ? a.imag() + P_eps < b.imag() : a.real() + P_eps < b.real();
  }
};

P rotate(P p, double theta) {
  return p * P(cos(theta), sin(theta));
}

//内積
P_type dot(P a, P b) {
  return (a * conj(b)).real();
}

//外積
P_type cross(P a, P b) {
  return (conj(a) * b).imag();
}

//反時計回り
int ccw(P a, P b, P c) {
  if (cross(b - a, c - a) > P_eps) return 1; //COUNTER_CLOCKWISE(center:a)
  if (cross(b - a, c - a) < -P_eps) return -1; //CLOCKWISE(center:a)
  if (dot(b - a, c - a) < -P_eps) return -2; //c -> a -> b
  if (dot(a - b, c - b) < -P_eps) return 2; //a -> b -> c
  return 0; //a -> c -> b
}

/* 線分交差判定 */
bool isIntersectedSS(P a1, P a2, P b1, P b2) {
  //線分a と 直線b
  int a = ccw(b1, b2, a1);
  int b = ccw(b1, b2, a2);

  //線分b と 直線a
  int c = ccw(a1, a2, b1);
  int d = ccw(a1, a2, b2);

  return a * b <= 0 && c * d <= 0; // T字を除く時は (** < 0)
}

/* 射影(直線abとpからの垂線との交点) */
P getProject(P a, P b, P p) {
  P base = b - a;
  return a + base * dot(p - a, base) / norm(base);
}

void chmin(double &a, double b) {
  if (a > b) { a = b; }
}

double solve(vector<P> a) {
  const int n = a.size();
  for (int i = 0; i < n; i++) a.push_back(a[i]);
  vector<vector<double>> dp(n * 2, vector<double>(n * 2, INFINITY));
  for (int i = 0; i < n * 2; i++) dp[i][i] = 0;
  for (int d = 0; d < n; d++) {
    for (int i = 0; i + d < n * 2; i++) {
      const int j = i + d;
      if (i) {
        chmin(dp[i - 1][j], max<double>(dp[i][j], abs(a[i - 1] - a[j])));
      }
      if (j + 1 < n * 2) {
        chmin(dp[i][j + 1], max<double>(dp[i][j], abs(a[i] - a[j + 1])));
      }
      if (i && j + 1 < n * 2) {
        chmin(dp[i][j + 1], max<double>(dp[i][j], abs(a[i - 1] - a[j + 1])));
      }
    }
  }
  double ans = INFINITY;
  for (int i = 0; i < n; i++) chmin(ans, dp[i][i + n]);
  return ans;
}

int main() {
  int N;
  vector<P> poly;

  scanf("%d", &N);

  for (int i = 0; i < N; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    poly.push_back(P(x, y));
  }

  vector<P> vec;

  for (int i = 0; i < N; i++) {
    P s = poly[i], t = poly[(i + 1) % N];

    vector<pair<G_real, P>> temp;

    for (int j = 0; j < N; j++) {
      if (j == i || (i + 1) % N == j) continue;

      auto proj = getProject(s, t, poly[j]);

      if (abs(s - proj) > P_eps && abs(t - proj) > P_eps && isIntersectedSS(s, t, poly[j], proj)) {
        temp.push_back({abs(s - proj), proj});
      }
    }

    sort(temp.begin(), temp.end());

    vec.push_back(s);
    for (auto v : temp) vec.push_back(v.second);
  }

  debug(vec);

  double ans = solve(vec);

  printf("%.10lf\n", ans);

  return 0;
}
accuracy: 0.08571428571428572
time_ms: 60
memory_kb: 40076
final_rank: 5

code_snippet: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using uint = unsigned;
using pcc = pair<char, char>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<ld, ld>;
using tuplis = array<ll, 3>;
template<class T> using pq = priority_queue<T, vector<T>, greater<T>>;
const ll LINF=0x1fffffffffffffff;
const ll MINF=0x7fffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
const int MODD=998244353;
const ld DINF=numeric_limits<ld>::infinity();
const ld EPS=1e-9;
const ld PI=3.1415926535897932;
const ll dx[] = {0, 1, 0, -1, 1, -1, 1, -1};
const ll dy[] = {1, 0, -1, 0, 1, 1, -1, -1};
#define overload4(_1,_2,_3,_4,name,...) name
#define overload3(_1,_2,_3,name,...) name
#define rep1(n) for(ll i=0;i<n;++i)
#define rep2(i,n) for(ll i=0;i<n;++i)
#define rep3(i,a,b) for(ll i=a;i<b;++i)
#define rep4(i,a,b,c) for(ll i=a;i<b;i+=c)
#define rep(...) overload4(__VA_ARGS__,rep4,rep3,rep2,rep1)(__VA_ARGS__)
#define rrep1(n) for(ll i=n;i--;)
#define rrep2(i,n) for(ll i=n;i--;)
#define rrep3(i,a,b) for(ll i=b;i-->(a);)
#define rrep4(i,a,b,c) for(ll i=(a)+((b)-(a)-1)/(c)*(c);i>=(a);i-=c)
#define rrep(...) overload4(__VA_ARGS__,rrep4,rrep3,rrep2,rrep1)(__VA_ARGS__)
#define each1(i,a) for(auto&&i:a)
#define each2(x,y,a) for(auto&&[x,y]:a)
#define each3(x,y,z,a) for(auto&&[x,y,z]:a)
#define each(...) overload4(__VA_ARGS__,each3,each2,each1)(__VA_ARGS__)
#define all1(i) begin(i),end(i)
#define all2(i,a) begin(i),begin(i)+a
#define all3(i,a,b) begin(i)+a,begin(i)+b
#define all(...) overload3(__VA_ARGS__,all3,all2,all1)(__VA_ARGS__)
#define rall1(i) (i).rbegin(),(i).rend()
#define rall2(i,k) (i).rbegin(),(i).rbegin()+k
#define rall3(i,a,b) (i).rbegin()+a,(i).rbegin()+b
#define rall(...) overload3(__VA_ARGS__,rall3,rall2,rall1)(__VA_ARGS__)
#define sum(...) accumulate(all(__VA_ARGS__),0LL)
#define dsum(...) accumulate(all(__VA_ARGS__),0.0L)
#define Msum(...) accumulate(all(__VA_ARGS__),0_M)
#define elif else if
#define unless(a) if(!(a))
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define ULL(...) ull __VA_ARGS__;in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;in(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;in(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;in(__VA_ARGS__)
#define LD(...) ld __VA_ARGS__;in(__VA_ARGS__)
#define Sort(a) sort(all(a))
#define Rev(a) reverse(all(a))
#define Uniq(a) sort(all(a));a.erase(unique(all(a)),end(a))
#define vec(type,name,...) vector<type>name(__VA_ARGS__)
#define VEC(type,name,size) vector<type>name(size);in(name)
#define vv(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define VV(type,name,h,w) vector<vector<type>>name(h,vector<type>(w));in(name)
#define vvv(type,name,h,w,...) vector<vector<vector<type>>>name(h,vector<vector<type>>(w,vector<type>(__VA_ARGS__)))
template<class T> auto min(const T& a){ return *min_element(all(a)); }
template<class T> auto max(const T& a){ return *max_element(all(a)); }
inline ll popcnt(ull a){ return __builtin_popcountll(a); }
ll gcd(ll a, ll b){ while(b){ ll c = b; b = a % b; a = c; } return a; }
ll lcm(ll a, ll b){ if(!a || !b) return 0; return a * b / gcd(a, b); }
ll intpow(ll a, ll b){ ll ans = 1; while(b){ if(b & 1) ans *= a; a *= a; b /= 2; } return ans; }
ll modpow(ll a, ll b, ll p){ ll ans = 1; while(b){ if(b & 1) (ans *= a) %= p; (a *= a) %= p; b /= 2; } return ans; }
template<class T> bool chmin(T& a, const T& b){ if(a > b){ a = b; return 1; } return 0; }
template<class T> bool chmax(T& a, const T& b){ if(a < b){ a = b; return 1; } return 0; }
template<class T, class U> bool chmin(T& a, const U& b){ if(a > T(b)){ a = b; return 1; } return 0; }
template<class T, class U> bool chmax(T& a, const U& b){ if(a < T(b)){ a = b; return 1; } return 0; }
vector<ll> iota(ll n, ll begin = 0){ vector<ll> a(n); iota(a.begin(), a.end(), begin); return a; }
vector<pll> factor(ull x){ vector<pll> ans; for(ull i = 2; i * i <= x; i++) if(x % i == 0){ ans.push_back({i, 1}); while((x /= i) % i == 0) ans.back().second++; } if(x != 1) ans.push_back({x, 1}); return ans; }
map<ll,ll> factor_map(ull x){ map<ll,ll> ans; for(ull i = 2; i * i <= x; i++) if(x % i == 0){ ans[i] = 1; while((x /= i) % i == 0) ans[i]++; } if(x != 1) ans[x] = 1; return ans; }
vector<ll> divisor(ull x){ vector<ll> ans; for(ull i = 1; i * i <= x; i++) if(x % i == 0) ans.push_back(i); rrep(ans.size() - (ans.back() * ans.back() == x)) ans.push_back(x / ans[i]); return ans; }
template<class T> unordered_map<T, ll> press(vector<T> a){ Uniq(a); unordered_map<T, ll> ans; rep(a.size()) ans[a[i]] = i; return ans; }
template<class T> map<T, ll> press_map(vector<T> a){ Uniq(a); map<T, ll> ans; rep(a.size()) ans[a[i]] = i; return ans; }
int scan(){ return getchar(); }
void scan(int& a){ scanf("%d", &a); }
void scan(unsigned& a){ scanf("%u", &a); }
void scan(long& a){ scanf("%ld", &a); }
void scan(long long& a){ scanf("%lld", &a); }
void scan(unsigned long long& a){ scanf("%llu", &a); }
void scan(char& a){ do{ a = getchar(); }while(a == ' ' || a == '\n'); }
void scan(float& a){ scanf("%f", &a); }
void scan(double& a){ scanf("%lf", &a); }
void scan(long double& a){ scanf("%Lf", &a); }
void scan(vector<bool>& a){ for(unsigned i = 0; i < a.size(); i++){ int b; scan(b); a[i] = b; } }
void scan(char a[]){ scanf("%s", a); }
void scan(string& a){ cin >> a; }
template<class T> void scan(vector<T>&);
template<class T, size_t size> void scan(array<T, size>&);
template<class T, class L> void scan(pair<T, L>&);
template<class T, size_t size> void scan(T(&)[size]);
template<class T> void scan(vector<T>& a){ for(auto&& i : a) scan(i); }
template<class T> void scan(deque<T>& a){ for(auto&& i : a) scan(i); }
template<class T, size_t size> void scan(array<T, size>& a){ for(auto&& i : a) scan(i); }
template<class T, class L> void scan(pair<T, L>& p){ scan(p.first); scan(p.second); }
template<class T, size_t size> void scan(T (&a)[size]){ for(auto&& i : a) scan(i); }
template<class T> void scan(T& a){ cin >> a; }
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){ scan(head); in(tail...); }
void print(){ putchar(' '); }
void print(bool a){ printf("%d", a); }
void print(int a){ printf("%d", a); }
void print(unsigned a){ printf("%u", a); }
void print(long a){ printf("%ld", a); }
void print(long long a){ printf("%lld", a); }
void print(unsigned long long a){ printf("%llu", a); }
void print(char a){ printf("%c", a); }
void print(char a[]){ printf("%s", a); }
void print(const char a[]){ printf("%s", a); }
void print(float a){ printf("%.15f", a); }
void print(double a){ printf("%.15f", a); }
void print(long double a){ printf("%.15Lf", a); }
void print(const string& a){ for(auto&& i : a) print(i); }
template<class T> void print(const complex<T>& a){ if(a.real() >= 0) print('+'); print(a.real()); if(a.imag() >= 0) print('+'); print(a.imag()); print('i'); }
template<class T> void print(const vector<T>&);
template<class T, size_t size> void print(const array<T, size>&);
template<class T, class L> void print(const pair<T, L>& p);
template<class T, size_t size> void print(const T (&)[size]);
template<class T> void print(const vector<T>& a){ if(a.empty()) return; print(a[0]); for(auto i = a.begin(); ++i != a.end(); ){ putchar(' '); print(*i); } }
template<class T> void print(const deque<T>& a){ if(a.empty()) return; print(a[0]); for(auto i = a.begin(); ++i != a.end(); ){ putchar(' '); print(*i); } }
template<class T, size_t size> void print(const array<T, size>& a){ print(a[0]); for(auto i = a.begin(); ++i != a.end(); ){ putchar(' '); print(*i); } }
template<class T, class L> void print(const pair<T, L>& p){ print(p.first); putchar(' '); print(p.second); }
template<class T, size_t size> void print(const T (&a)[size]){ print(a[0]); for(auto i = a; ++i != end(a); ){ putchar(' '); print(*i); } }
template<class T> void print(const T& a){ cout << a; }
int out(){ putchar('\n'); return 0; }
template<class T> int out(const T& t){ print(t); putchar('\n'); return 0; }
template<class Head, class... Tail> int out(const Head& head, const Tail&... tail){ print(head); putchar(' '); out(tail...); return 0; }
#ifdef DEBUG
inline ll __lg(ull x){ return 63 - __builtin_clzll(x); }
#define debug(...) { print(#__VA_ARGS__); print(":"); out(__VA_ARGS__); }
#else
#define debug(...) void(0)
#endif
int first(bool i = true){ return out(i?"first":"second"); }
int First(bool i = true){ return out(i?"First":"Second"); }
int yes(bool i = true){ return out(i?"yes":"no"); }
int Yes(bool i = true){ return out(i?"Yes":"No"); }
int No(){ return out("No"); }
int YES(bool i = true){ return out(i?"YES":"NO"); }
int NO(){ return out("NO"); }
int Yay(bool i = true){ return out(i?"Yay!":":("); }
int possible(bool i = true){ return out(i?"possible":"impossible"); }
int Possible(bool i = true){ return out(i?"Possible":"Impossible"); }
int POSSIBLE(bool i = true){ return out(i?"POSSIBLE":"IMPOSSIBLE"); }
void Case(ll i){ printf("Case #%lld: ", i); }


using Real = ld;
using Point = complex< Real >;

inline bool eq(Real a, Real b) { return fabs(b - a) < EPS; }

Point operator*(const Point &p, const Real &d) {
  return Point(real(p) * d, imag(p) * d);
}

istream &operator>>(istream &is, Point &p) {
  Real a, b;
  is >> a >> b;
  p = Point(a, b);
  return is;
}

ostream &operator<<(ostream &os, Point &p) {
  return os << fixed << setprecision(10) << p.real() << " " << p.imag();
}

// rotate point p counterclockwise by theta rad
Point rotate(Real theta, const Point &p) {
  return Point(cos(theta) * p.real() - sin(theta) * p.imag(), sin(theta) * p.real() + cos(theta) * p.imag());
}

Real radian_to_degree(Real r) {
  return (r * 180.0 / PI);
}

Real degree_to_radian(Real d) {
  return (d * PI / 180.0);
}

// smaller angle of the a-b-c
Real get_angle(const Point &a, const Point &b, const Point &c) {
  const Point v(b - a), w(c - b);
  Real alpha = atan2(v.imag(), v.real()), beta = atan2(w.imag(), w.real());
  if(alpha > beta) swap(alpha, beta);
  Real theta = (beta - alpha);
  return min(theta, 2 * acos(-1) - theta);
}

namespace std {
  bool operator<(const Point &a, const Point &b) {
    return a.real() != b.real() ? a.real() < b.real() : a.imag() < b.imag();
  }
}


struct Line {
  Point a, b;

  Line() = default;

  Line(Point a, Point b) : a(a), b(b) {}

  Line(Real A, Real B, Real C) // Ax + By = C
  {
    if(eq(A, 0)) a = Point(0, C / B), b = Point(1, C / B);
    else if(eq(B, 0)) b = Point(C / A, 0), b = Point(C / A, 1);
    else a = Point(0, C / B), b = Point(C / A, 0);
  }

  friend ostream &operator<<(ostream &os, Line &p) {
    return os << p.a << " to " << p.b;
  }

  friend istream &operator>>(istream &is, Line &a) {
    return is >> a.a >> a.b;
  }
};

struct Segment : Line {
  Segment() = default;

  Segment(Point a, Point b) : Line(a, b) {}
};

struct Circle {
  Point p;
  Real r;

  Circle() = default;

  Circle(Point p, Real r) : p(p), r(r) {}
};

using Points = vector< Point >;
using Polygon = vector< Point >;
using Segments = vector< Segment >;
using Lines = vector< Line >;
using Circles = vector< Circle >;

Real cross(const Point &a, const Point &b) {
  return real(a) * imag(b) - imag(a) * real(b);
}

Real dot(const Point &a, const Point &b) {
  return real(a) * real(b) + imag(a) * imag(b);
}

int ccw(const Point &a, Point b, Point c) {
  b = b - a, c = c - a;
  if(cross(b, c) > EPS) return +1;  // "COUNTER_CLOCKWISE"
  if(cross(b, c) < -EPS) return -1; // "CLOCKWISE"
  if(dot(b, c) < 0) return +2;      // "ONLINE_BACK" c-a-b
  if(norm(b) < norm(c)) return -2;  // "ONLINE_FRONT" a-b-c
  return 0;                         // "ON_SEGMENT" a-c-b
}

// 平行
bool parallel(const Line &a, const Line &b) {
  return eq(cross(a.b - a.a, b.b - b.a), 0.0);
}

// 直交
bool orthogonal(const Line &a, const Line &b) {
  return eq(dot(a.a - a.b, b.a - b.b), 0.0);
}

// 点に直線から垂線を引いたときの交点
Point projection(const Line &l, const Point &p) {
  double t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
  return l.a + (l.a - l.b) * t;
}

Point projection(const Segment &l, const Point &p) {
  double t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
  return l.a + (l.a - l.b) * t;
}

// 線対称な位置の点
Point reflection(const Line &l, const Point &p) {
  return p + (projection(l, p) - p) * 2.0;
}

bool intersect(const Line &l, const Point &p) {
  return abs(ccw(l.a, l.b, p)) != 1;
}

bool intersect(const Line &l, const Line &m) {
  return abs(cross(l.b - l.a, m.b - m.a)) > EPS || abs(cross(l.b - l.a, m.b - l.a)) < EPS;
}

bool intersect(const Segment &s, const Point &p) {
  return ccw(s.a, s.b, p) == 0;
}

bool intersect(const Line &l, const Segment &s) {
  return cross(l.b - l.a, s.a - l.a) * cross(l.b - l.a, s.b - l.a) < EPS;
}

Real distance(const Line &l, const Point &p);

bool intersect(const Circle &c, const Line &l) {
  return distance(l, c.p) <= c.r + EPS;
}

bool intersect(const Circle &c, const Point &p) {
  return abs(abs(p - c.p) - c.r) < EPS;
}

bool intersect(const Segment &s, const Segment &t) {
  return ccw(s.a, s.b, t.a) * ccw(s.a, s.b, t.b) <= 0 && ccw(t.a, t.b, s.a) * ccw(t.a, t.b, s.b) <= 0;
}

int intersect(const Circle &c, const Segment &l) {
  if(norm(projection(l, c.p) - c.p) - c.r * c.r > EPS) return 0;
  auto d1 = abs(c.p - l.a), d2 = abs(c.p - l.b);
  if(d1 < c.r + EPS && d2 < c.r + EPS) return 0;
  if(d1 < c.r - EPS && d2 > c.r + EPS || d1 > c.r + EPS && d2 < c.r - EPS) return 1;
  const Point h = projection(l, c.p);
  if(dot(l.a - h, l.b - h) < 0) return 2;
  return 0;
}

// 2円の共通接線の数
int intersect(Circle c1, Circle c2) {
  if(c1.r < c2.r) swap(c1, c2);
  Real d = abs(c1.p - c2.p);
  if(c1.r + c2.r < d) return 4; // 離れている
  if(eq(c1.r + c2.r, d)) return 3; // 外接
  if(c1.r - c2.r < d) return 2; // 交わる
  if(eq(c1.r - c2.r, d)) return 1; // 内接
  return 0; // 内包
}

Real distance(const Point &a, const Point &b) {
  return abs(a - b);
}

Real distance(const Line &l, const Point &p) {
  return abs(p - projection(l, p));
}

Real distance(const Line &l, const Line &m) {
  return intersect(l, m) ? 0 : distance(l, m.a);
}

Real distance(const Segment &s, const Point &p) {
  Point r = projection(s, p);
  if(intersect(s, r)) return abs(r - p);
  return min(abs(s.a - p), abs(s.b - p));
}

Real distance(const Segment &a, const Segment &b) {
  if(intersect(a, b)) return 0;
  return min({distance(a, b.a), distance(a, b.b), distance(b, a.a), distance(b, a.b)});
}

Real distance(const Line &l, const Segment &s) {
  if(intersect(l, s)) return 0;
  return min(distance(l, s.a), distance(l, s.b));
}

Point crosspoint(const Line &l, const Line &m) {
  Real A = cross(l.b - l.a, m.b - m.a);
  Real B = cross(l.b - l.a, l.b - m.a);
  if(eq(abs(A), 0.0) && eq(abs(B), 0.0)) return m.a;
  return m.a + (m.b - m.a) * B / A;
}

Point crosspoint(const Segment &l, const Segment &m) {
  return crosspoint(Line(l), Line(m));
}

pair< Point, Point > crosspoint(const Circle &c, const Line l) {
  Point pr = projection(l, c.p);
  Point e = (l.b - l.a) / abs(l.b - l.a);
  if(eq(distance(l, c.p), c.r)) return {pr, pr};
  double base = sqrt(c.r * c.r - norm(pr - c.p));
  return {pr - e * base, pr + e * base};
}

pair< Point, Point > crosspoint(const Circle &c, const Segment &l) {
  Line aa = Line(l.a, l.b);
  if(intersect(c, l) == 2) return crosspoint(c, aa);
  auto ret = crosspoint(c, aa);
  if(dot(l.a - ret.first, l.b - ret.first) < 0) ret.second = ret.first;
  else ret.first = ret.second;
  return ret;
}

pair< Point, Point > crosspoint(const Circle &c1, const Circle &c2) {
  Real d = abs(c1.p - c2.p);
  Real a = acos((c1.r * c1.r + d * d - c2.r * c2.r) / (2 * c1.r * d));
  Real t = atan2(c2.p.imag() - c1.p.imag(), c2.p.real() - c1.p.real());
  Point p1 = c1.p + Point(cos(t + a) * c1.r, sin(t + a) * c1.r);
  Point p2 = c1.p + Point(cos(t - a) * c1.r, sin(t - a) * c1.r);
  return {p1, p2};
}


int main(){
    LL(n);
    vec(Point,a,n);
    rep(n){
        LD(x,y);
        a[i]={x,y};
    }
    rep(n*2)a.push_back(a[i]);
    ld ans=DINF;
    rep(n)rep(j,i,i+n+1){
        const ll k=i+n;
        ld mx=0;
        rep(x,i,j+1){
            ld mn=DINF;
            rep(y,j,k){
                chmin(mn,distance(Segment{a[y],a[y+1]},a[x]));
            }
            chmax(mx,mn);
        }
        rep(x,j,k+1){
            ld mn=DINF;
            rep(y,i,j){
                chmin(mn,distance(Segment{a[y],a[y+1]},a[x]));
            }
            chmax(mx,mn);
        }
        chmin(ans,mx);
    }
    out(ans);
}
accuracy: 0.22857142857142856
time_ms: 210
memory_kb: 3640
final_rank: 4

code_snippet: #include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
#include<array>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
constexpr ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acosl(-1.0);

ll mod_pow(ll x, ll n, ll m = mod) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * x % m;
		x = x * x % m; n >>= 1;
	}
	return res;
}
struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n % mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint& a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint& a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint& a, modint b) { a.n = ((ll)a.n * b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, ll n) {
	if (n == 0)return modint(1);
	modint res = (a * a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p % a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}

#include<complex>
typedef complex<ld> Point;
ld dot(Point a, Point b) { return real(conj(a) * b); }
ld cross(Point a, Point b) { return imag(conj(a) * b); }
namespace std {
	bool operator<(const Point& lhs, const Point& rhs) {
		return lhs.real() == rhs.real() ? lhs.imag() < rhs.imag() : lhs.real() < rhs.real();
	}
}
struct Line {
	Point a, b;
};
int ccw(Point a, Point b, Point c) {
	b -= a; c -= a;
	if (cross(b, c) > eps)return 1;//counter clockwise
	if (cross(b, c) < -eps)return -1;//clock wise
	if (dot(b, c) < 0)return 2;//c--a--b on line
	if (norm(b) < norm(c))return -2;//a--b--c on line
	return 0; //a--c--b on line
}
//点から直線への垂線の足
Point proj(Line l, Point p) {
	ld t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
	return l.a + t * (l.a - l.b);
}
//直線と点の距離
ld dist_lp(Line l, Point p) {
	return abs(p - proj(l, p));
}
//点が線分上に存在するか
bool isis_sp(Line s, Point p) {
	return (abs(s.a - p) + abs(s.b - p) - abs(s.b - s.a) < eps);
}
ld dist_sp(Line s, Point p) {
	Point r = proj(s, p);
	return isis_sp(s, r) ? abs(p - r) : min(abs(p - s.a), abs(p - s.b));
}
struct ste {
	int x,y;
};
bool operator<(const ste& a, const ste& b) {
	if (a.x != b.x)return a.x < b.x;
	else return a.y < b.y;
}
using speP = pair<ld, ste>;

ld lcost[50][50][50];
ld dist[50][50];
void solve() {
	int n; cin >> n;
	vector<ld> x(n), y(n);
	rep(i, n) {
		cin >> x[i] >> y[i];
	}
	vector<vector<ld>> cost(n, vector<ld>(n));

	rep(i, n)rep(j, n) {
		ld dx = abs(x[j] - x[i]);
		ld dy = abs(y[j] - y[i]);
		cost[i][j] = sqrtl(dx * dx + dy * dy);
	}

	rep(i, n) {
		Point pl = { x[i],y[i] };
		Point pr = { x[(i + 1) % n],y[(i + 1) % n] };
		rep(j, n) {
			ld ma = dist_sp({ pl,pr }, { x[j],y[j] });
			for (int k = 1; k <= n; k++) {
				int to = (j + k) % n;
				ma = max(ma, dist_sp({ pl,pr }, { x[to],y[to] }));
				lcost[i][j][to] = ma;
			}
		}
	}
	//rep(i, n)rep(j, n)rep(k, n)cout << i << " " << j << " " << k << " " << lcost[i][j][k] << "\n";
	
	rep(i, n)rep(j, n)dist[i][j] = INF;
	priority_queue<speP, vector<speP>, greater<speP>> q;
	rep(i, 1) {
		dist[i][i] = 0;
		q.push({ 0,{i,i} });
	}
	ld ans = INF;
	while (!q.empty()) {
		speP p = q.top(); q.pop();
		ste s = p.second;
		ld d = p.first;
		if (d > dist[s.x][s.y])continue;
		//cout << s.x << " " << s.y << " " << d << "\n";
		int dif = s.y - s.x; if (dif < 0)dif += n;
		//left zero
		for (int j = -1; j <= 1; j += 2) {
			int tx = s.x;
			int ty = s.y + j;
			if (tx < 0)tx += n;
			if (tx >= n)tx -= n;
			if (ty < 0)ty += n;
			if (ty >= n)ty -= n;
			int tz = dif + j;
			ld nd = max(d, cost[tx][ty]);
			
			if (tz < 0)continue;
			else if (tz == n) {
				ans = min(ans,nd);
			}
			else {
				if (nd < dist[tx][ty]) {
					dist[tx][ty] = nd;
					q.push({ nd,{tx,ty} });
				}
			}
		}
		//right zero
		for (int j = -1; j <= 1; j += 2) {
			int tx = s.x + j;
			int ty = s.y;
			if (tx < 0)tx += n;
			if (tx >= n)tx -= n;
			if (ty < 0)ty += n;
			if (ty >= n)ty -= n;
			int tz = dif - j;
			ld nd = max(d, cost[tx][ty]);
			if (tz < 0)continue;
			else if (tz == n) {
				ans = min(ans, nd);
			}
			else {
				if (nd < dist[tx][ty]) {
					dist[tx][ty] = nd;
					q.push({ nd,{tx,ty} });
				}
			}
		}
		//left
		for (int i = -1; i <= 1; i += 2) {
			int cx = s.x; if (i < 0)cx--; if (cx < 0)cx += n;
			for (int j = -n; j<=n; j++) {
				int tx = s.x+i;
				int ty = s.y + j;
				int tz = dif -i + j;
				if (tx < 0)tx += n;
				if (tx >= n)tx -= n;
				if (ty < 0)ty += n;
				if (ty >= n)ty -= n;
				ld nd = d;
				nd = max(nd, cost[tx][ty]);
				if (j <= 0)nd = max(nd, lcost[cx][ty][s.y]);
				else nd = max(nd, lcost[cx][s.y][ty]);
				if (tz<0 || tz>n)continue;
				else if (tz == n) {
					ans = min(ans, nd);
				}
				else {
					if (dist[tx][ty] > nd) {
						dist[tx][ty] = nd;
						q.push({ nd,{tx,ty} });
					}
				}
			}
		}
		//right
		for (int j = -1; j <= 1; j += 2) {
			int cy = s.y; if (j < 0)cy--; if (cy < 0)cy += n;
			for (int i = -n; i <= n; i++) {
				int tx = s.x + i;
				int ty = s.y + j;
				int tz = dif - i + j;
				if (tx < 0)tx += n;
				if (tx >= n)tx -= n;
				if (ty < 0)ty += n;
				if (ty >= n)ty -= n;
				ld nd = d;
				nd = max(nd, cost[tx][ty]);
				if (i <= 0)nd = max(nd, lcost[cy][tx][s.x]);
				else nd = max(nd, lcost[cy][s.x][tx]);
				if (tz<0 || tz>n)continue;
				else if (tz == n) {
					ans = min(ans, nd);
				}
				else {
					if (dist[tx][ty] > nd) {
						dist[tx][ty] = nd;
						q.push({ nd,{tx,ty} });
					}
				}
			}
		}
	}
	//rep(i, n)rep(j, n)cout << i << " " << j << " " << dist[i][j] << "\n";
	cout << ans << "\n";
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(10);
	//init_f();
	//init();
	//expr();
	//int t; cin >> t; rep(i, t)
	solve();
	return 0;
}
accuracy: 0.6
time_ms: 10
memory_kb: 8736
final_rank: 2

code_snippet: #include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
#include<array>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
constexpr ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acosl(-1.0);

ll mod_pow(ll x, ll n, ll m = mod) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * x % m;
		x = x * x % m; n >>= 1;
	}
	return res;
}
struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n % mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint& a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint& a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint& a, modint b) { a.n = ((ll)a.n * b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, ll n) {
	if (n == 0)return modint(1);
	modint res = (a * a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p % a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}

#include<complex>
typedef complex<ld> Point;
ld dot(Point a, Point b) { return real(conj(a) * b); }
ld cross(Point a, Point b) { return imag(conj(a) * b); }
namespace std {
	bool operator<(const Point& lhs, const Point& rhs) {
		return lhs.real() == rhs.real() ? lhs.imag() < rhs.imag() : lhs.real() < rhs.real();
	}
}
struct Line {
	Point a, b;
};
int ccw(Point a, Point b, Point c) {
	b -= a; c -= a;
	if (cross(b, c) > eps)return 1;//counter clockwise
	if (cross(b, c) < -eps)return -1;//clock wise
	if (dot(b, c) < 0)return 2;//c--a--b on line
	if (norm(b) < norm(c))return -2;//a--b--c on line
	return 0; //a--c--b on line
}
//点から直線への垂線の足
Point proj(Line l, Point p) {
	ld t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
	return l.a + t * (l.a - l.b);
}
//直線と点の距離
ld dist_lp(Line l, Point p) {
	return abs(p - proj(l, p));
}
//点が線分上に存在するか
bool isis_sp(Line s, Point p) {
	return (abs(s.a - p) + abs(s.b - p) - abs(s.b - s.a) < eps);
}
ld dist_sp(Line s, Point p) {
	Point r = proj(s, p);
	return isis_sp(s, r) ? abs(p - r) : min(abs(p - s.a), abs(p - s.b));
}
struct ste {
	int x,y;
};
bool operator<(const ste& a, const ste& b) {
	if (a.x != b.x)return a.x < b.x;
	else return a.y < b.y;
}
using speP = pair<ld, ste>;

ld lcost[50][50][50];
ld dist[50][50];
void solve() {
	int n; cin >> n;
	vector<ld> x(n), y(n);
	rep(i, n) {
		cin >> x[i] >> y[i];
	}
	vector<vector<ld>> cost(n, vector<ld>(n));

	rep(i, n)rep(j, n) {
		ld dx = abs(x[j] - x[i]);
		ld dy = abs(y[j] - y[i]);
		cost[i][j] = sqrtl(dx * dx + dy * dy);
	}

	rep(i, n) {
		Point pl = { x[i],y[i] };
		Point pr = { x[(i + 1) % n],y[(i + 1) % n] };
		rep(j, n) {
			ld ma = dist_sp({ pl,pr }, { x[j],y[j] });
			for (int k = 1; k <= n; k++) {
				int to = (j + k) % n;
				ma = max(ma, dist_sp({ pl,pr }, { x[to],y[to] }));
				lcost[i][j][to] = ma;
			}
		}
	}
	//rep(i, n)rep(j, n)rep(k, n)cout << i << " " << j << " " << k << " " << lcost[i][j][k] << "\n";
	
	rep(i, n)rep(j, n)dist[i][j] = INF;
	priority_queue<speP, vector<speP>, greater<speP>> q;
	rep(i, 1) {
		dist[i][i] = 0;
		q.push({ 0,{i,i} });
	}
	ld ans = INF;
	while (!q.empty()) {
		speP p = q.top(); q.pop();
		ste s = p.second;
		ld d = p.first;
		if (d > dist[s.x][s.y])continue;
		//cout << s.x << " " << s.y << " " << d << "\n";
		int dif = s.y - s.x; if (dif < 0)dif += n;
		//left zero
		for (int j = -1; j <= 1; j += 2) {
			int tx = s.x;
			int ty = s.y + j;
			if (tx < 0)tx += n;
			if (tx >= n)tx -= n;
			if (ty < 0)ty += n;
			if (ty >= n)ty -= n;
			int tz = dif + j;
			ld nd = max(d, cost[tx][ty]);
			
			if (tz < 0)continue;
			else if (tz == n) {
				ans = min(ans,nd);
			}
			else {
				if (nd < dist[tx][ty]) {
					dist[tx][ty] = nd;
					q.push({ nd,{tx,ty} });
				}
			}
		}
		//right zero
		for (int j = -1; j <= 1; j += 2) {
			int tx = s.x + j;
			int ty = s.y;
			if (tx < 0)tx += n;
			if (tx >= n)tx -= n;
			if (ty < 0)ty += n;
			if (ty >= n)ty -= n;
			int tz = dif - j;
			ld nd = max(d, cost[tx][ty]);
			if (tz < 0)continue;
			else if (tz == n) {
				ans = min(ans, nd);
			}
			else {
				if (nd < dist[tx][ty]) {
					dist[tx][ty] = nd;
					q.push({ nd,{tx,ty} });
				}
			}
		}
		//left
		for (int i = -1; i <= 1; i += 2) {
			int cx = s.x; if (i < 0)cx--; if (cx < 0)cx += n;
			for (int j = -n; j<=n; j++) {
				if (abs(j) == n)continue;
				int tx = s.x+i;
				int ty = s.y + j;
				int tz = dif -i + j;
				if (tx < 0)tx += n;
				if (tx >= n)tx -= n;
				if (ty < 0)ty += n;
				if (ty >= n)ty -= n;
				ld nd = d;
				nd = max(nd, cost[tx][ty]);
				if (j <= 0)nd = max(nd, lcost[cx][ty][s.y]);
				else nd = max(nd, lcost[cx][s.y][ty]);
				if (tz<0 || tz>n)continue;
				else if (tz == n) {
					ans = min(ans, nd);
				}
				else {
					if (dist[tx][ty] > nd) {
						dist[tx][ty] = nd;
						q.push({ nd,{tx,ty} });
					}
				}
			}
		}
		//right
		for (int j = -1; j <= 1; j += 2) {
			int cy = s.y; if (j < 0)cy--; if (cy < 0)cy += n;
			for (int i = -n; i <= n; i++) {
				if (abs(i) == n)continue;
				int tx = s.x + i;
				int ty = s.y + j;
				int tz = dif - i + j;
				if (tx < 0)tx += n;
				if (tx >= n)tx -= n;
				if (ty < 0)ty += n;
				if (ty >= n)ty -= n;
				ld nd = d;
				nd = max(nd, cost[tx][ty]);
				if (i <= 0)nd = max(nd, lcost[cy][tx][s.x]);
				else nd = max(nd, lcost[cy][s.x][tx]);
				if (tz<0 || tz>n)continue;
				else if (tz == n) {
					ans = min(ans, nd);
				}
				else {
					if (dist[tx][ty] > nd) {
						dist[tx][ty] = nd;
						q.push({ nd,{tx,ty} });
					}
				}
			}
		}
	}
	//rep(i, n)rep(j, n)cout << i << " " << j << " " << dist[i][j] << "\n";
	cout << ans << "\n";
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(10);
	//init_f();
	//init();
	//expr();
	//int t; cin >> t; rep(i, t)
	solve();
	return 0;
}
accuracy: 0.6
time_ms: 10
memory_kb: 8836
final_rank: 3

code_snippet: #include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
#include<array>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
constexpr ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acosl(-1.0);

ll mod_pow(ll x, ll n, ll m = mod) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * x % m;
		x = x * x % m; n >>= 1;
	}
	return res;
}
struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n % mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint& a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint& a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint& a, modint b) { a.n = ((ll)a.n * b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, ll n) {
	if (n == 0)return modint(1);
	modint res = (a * a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p % a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}

#include<complex>
typedef complex<ld> Point;
ld dot(Point a, Point b) { return real(conj(a) * b); }
ld cross(Point a, Point b) { return imag(conj(a) * b); }
namespace std {
	bool operator<(const Point& lhs, const Point& rhs) {
		return lhs.real() == rhs.real() ? lhs.imag() < rhs.imag() : lhs.real() < rhs.real();
	}
}
struct Line {
	Point a, b;
};
int ccw(Point a, Point b, Point c) {
	b -= a; c -= a;
	if (cross(b, c) > eps)return 1;//counter clockwise
	if (cross(b, c) < -eps)return -1;//clock wise
	if (dot(b, c) < 0)return 2;//c--a--b on line
	if (norm(b) < norm(c))return -2;//a--b--c on line
	return 0; //a--c--b on line
}
//点から直線への垂線の足
Point proj(Line l, Point p) {
	ld t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
	return l.a + t * (l.a - l.b);
}


struct ste {
	int le, ri;
};
bool operator<(const ste& a, const ste& b) {
	if (a.le != b.le)return a.le < b.le;
	return a.ri < b.ri;
}
using speP = pair<ld, ste>;
void solve() {
	int n; cin >> n;
	vector<ld> x(n), y(n);
	rep(i, n) {
		cin >> x[i] >> y[i];
	}
	vector<ld> vx, vy;
	rep(i, n) {
		vx.push_back(x[i]);
		vy.push_back(y[i]);
		//(x_i,y_i)->(x_{i+1},y_{i+1})
		Point pl = { x[i],y[i] };
		Point pr = { x[(i + 1) % n],y[(i + 1) % n] };
		Line l = { pl,pr };
		vector<ld> ts;
		for (int j = 0; j < n - 2; j++) {
			int to = i + 2 + j; to %= n;
			Point p = proj(l, { x[to],y[to] });
			if (ccw(pl,pr, p) == 0) {
				ld t = abs(p - pl) / abs(pr - pl);
				ts.push_back(t);
			}
		}
		sort(all(ts));
		rep(j, ts.size()) {
			Point nex = pl * (1 - ts[j]) + pr * ts[j];
			vx.push_back(real(nex));
			vy.push_back(imag(nex));
		}
	}
	n = vx.size();
	x = vx, y = vy;

	vector<vector<ld>> cost(n, vector<ld>(n));

	rep(i, n)rep(j, n) {
		ld dx = abs(x[j] - x[i]);
		ld dy = abs(y[j] - y[i]);
		cost[i][j] = sqrtl(dx * dx + dy * dy);
	}
	vector<vector<ld>> dist(n, vector<ld>(n, INF));
	rep(i, n)rep(j, n)dist[i][j] = INF;
	priority_queue<speP, vector<speP>, greater<speP>> q;
	rep(i, n) {
		dist[i][i] = 0;
		q.push({ 0,{i,i} });
	}
	ld ans = INF;
	while (!q.empty()) {
		speP p = q.top(); q.pop();
		ste s = p.second;
		ld d = p.first;
		if (d > dist[s.le][s.ri])continue;
		for (int i = -1; i <= 1; i++)for (int j = -1; j <= 1; j++) {
			if (s.le == s.ri) {
				if (i >= j)continue;
			}
			else if ((s.le + 1) % n == s.ri) {
				if (i>j)continue;
			}
			else if ((s.le + 2) % n == s.ri) {
				if (i > j + 1)continue;
			}
			int tx = s.le + i;
			int ty = s.ri + j;
			if (tx < 0)tx += n;
			if (tx >= n)tx -= n;
			if (ty < 0)ty += n;
			if (ty >= n)ty -= n;
			ld nd = max(d, cost[tx][ty]);
			if (nd < dist[tx][ty]) {
				dist[tx][ty] = nd;
				q.push({ nd,{tx,ty} });
			}
			if (tx == ty) {
				ans = min(ans, nd);
			}
		}
	}
	//rep(i, n)rep(j, n)cout << i << " " << j << " " << dist[i][j] << "\n";
	cout << ans << "\n";
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	//init_f();
	//init();
	//expr();
	//int t; cin >> t; rep(i, t)
		solve();
	return 0;
}
accuracy: 0.08571428571428572
time_ms: 220
memory_kb: 28572
final_rank: 7

code_snippet: #include <bits/stdc++.h>

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define HHH(x) cerr << "L" << __LINE__ << ": " << #x << " = " << (x) << endl

template <typename T> T &chmin(T &a, const T &b) { return a = std::min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = std::max(a, b); }

using ll = long long;
using ld = long double;

using namespace std;

using ld = long double;
using P = complex<ld>;
using VP = vector<P>;
const ld eps = 1e-8, pi = acos(-1.0);

#define EQ(a,b) (abs((a)-(b))<eps)

ld dot (P a, P b) { return real(conj(a) * b); }
ld cross (P a, P b) { return imag(conj(a) * b); }

namespace std {
  bool operator<(const P &lhs, const P &rhs) {
    return lhs.real() == rhs.real() ? lhs.imag() < rhs.imag()
                                    : lhs.real() < rhs.real();
  }
}

int ccw (P a, P b, P c) {
  b -= a; c -= a;
  if (cross(b, c) > eps) return 1;   // counter clockwise
  if (cross(b, c) < -eps) return -1; // clockwise
  if (dot(b, c) < 0) return 2;       // c--a--b on line
  if (norm(b) < norm(c)) return -2;  // a--b--c on line
  return 0;                          // a--c--b on line
}

struct L{ P a, b; };

P proj(L l, P p) {
  ld t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
  return l.a + t * (l.a - l.b);
}

bool isis_sp(L s, P p) {
  return abs(s.a - p) + abs(s.b - p) - abs(s.b - s.a) < eps;
}

bool isis_ss(L s, L t) {
  return ccw(s.a, s.b, t.a) * ccw(s.a, s.b, t.b) <= 0 &&
         ccw(t.a, t.b, s.a) * ccw(t.a, t.b, s.b) <= 0;
}

ld dist_sp(L s, P p) {
  P r = proj(s, p);
  if (isis_sp(s, r)) return abs(r - p);
  return min(abs(s.a - p), abs(s.b - p));
}

ld dist_ss(L s, L t) {
  if (isis_ss(s, t)) return 0;
  ld a = min(dist_sp(s, t.a), dist_sp(t, s.a));
  ld b = min(dist_sp(s, t.b), dist_sp(t, s.b));
  return min(a, b);
}

ld dist[128][128];
ld max_dist[256][256];
bool visited[256][256];

int main() {
  int n;
  cin >> n;
  vector<P> poly;
  REP(i,n) {
    ld x, y;
    cin >> x >> y;
    poly.emplace_back(x, y);
  }
  REP(i,n) REP(j,n) {
    dist[i*2][j*2] = abs(poly[i] - poly[j]);
    L si = (L){poly[i], poly[(i+1)%n]};
    L sj = (L){poly[j], poly[(j+1)%n]};
    dist[i*2+1][j*2] = dist_sp(si, poly[j]);
    dist[i*2][j*2+1] = dist_sp(sj, poly[i]);
    dist[i*2+1][j*2+1] = dist_ss(si, sj);
  }
  REP(i,256) REP(j,256) max_dist[i][j] = 1e18;
  using T = tuple<ld, int, int>;
  priority_queue<T, vector<T>, greater<T>> que;
  que.emplace(0, 0, 0);
  max_dist[0][0] = 0;

  // REP(i,2*n) {
  //   REP(j,2*n) cout << dist[i][j] << " ";
  //   cout << endl;
  // }

  while (!que.empty()) {
    ld max_d;
    int i, j;
    tie(max_d, i, j) = que.top();
    que.pop();
    if (visited[i][j]) continue;
    visited[i][j] = true;

    // cout << i << " " << j << " " << max_dist[i][j] << endl;

    auto update = [&](int new_i, int new_j) {
                    new_i = (new_i + 4 * n) % (4 * n);
                    new_j = (new_j + 4 * n) % (4 * n);
                    if (visited[new_i][new_j]) return;
                    ld new_dist = max(max_d, dist[new_i % (2 * n)][new_j % (2 * n)]);
                    if (max_dist[new_i][new_j] > new_dist) {
                      max_dist[new_i][new_j] = new_dist;
                      que.emplace(new_dist, new_i, new_j);
                    }
                  };
    update(i - 1, j);
    update(i, j - 1);
    update(i + 1, j);
    update(i, j + 1);
  }
  ld res = 1e18;
  REP(i,n*2) {
    // int j = i + n * 2;
    // cout << i << " " << j << " " << max_dist[i][j] << endl;
    chmin(res, max_dist[i][i+n*2]);
  }
  cout << setprecision(12) << fixed;
  cout << res << endl;
  return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 5188
final_rank: 1