#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned long long ull; static const double EPS = 1e-8; static const double PI = 4.0 * atan(1.0); static const double PI2 = 8.0 * atan(1.0); #define REP(i,n) for(int i=0;i<(int)n;++i) #define ALL(c) (c).begin(),(c).end() #define CLEAR(v) memset(v,0,sizeof(v)) #define MP(a,b) make_pair((a),(b)) #define ABS(a) ((a)>0?(a):-(a)) #define FOR(i,s,n) for(int i=s;i<(int)n;++i) int N; double X[1000], Y[1000]; int es[1000][1000]; int c[1000]; typedef pair P; int main(int argc, char **argv) { cin >> N; REP(i, N) cin >> X[i] >> Y[i]; REP(i, N) es[i][i] = 1000000000; REP(i, N) FOR(j, i + 1, N) { double dx = X[j] - X[i], dy = Y[j] - Y[i]; es[i][j] = (int)ceil(hypotl(dx, dy) / 10); es[j][i] = es[i][j]; } REP(i, N) c[i] = 1000000000; priority_queue, greater

> q; q.push(MP(0, 0)); while (!q.empty()) { P p = q.top(); q.pop(); int f = p.first, v = p.second; if (c[v] <= f) continue; c[v] = f; if (v == N - 1) break; REP(i, N) { if (i == v) continue; q.push(MP(max(f, es[v][i]), i)); } } cout << ((ll)10 * c[N - 1]) << endl; return 0; }