Problem:
Score : 600 points

Problem Statement

Given are N points (x_i, y_i) in a two-dimensional plane.

Find the minimum radius of a circle such that all the points are inside or on it.

Constraints

2 \leq N \leq 50

0 \leq x_i \leq 1000

0 \leq y_i \leq 1000

The given N points are all different.

The values in input are all integers.

Input

Input is given from Standard Input in the following format:

N
x_1 y_1
:
x_N y_N

Output

Print the minimum radius of a circle such that all the N points are inside or on it.

Your output will be considered correct if the absolute or relative error from our answer is at most 10^{-6}.

Sample Input 1

2
0 0
1 0

Sample Output 1

0.500000000000000000

Both points are contained in the circle centered at (0.5,0) with a radius of 0.5.

Sample Input 2

3
0 0
0 1
1 0

Sample Output 2

0.707106781186497524

Sample Input 3

10
10 9
5 9
2 0
0 0
2 7
3 3
2 5
10 0
3 7
1 9

Sample Output 3

6.726812023536805158

If the absolute or relative error from our answer is at most 10^{-6}, the output will be considered correct.

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vll = vector<ll>;
template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;
constexpr double eps = 1e-12;

template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

double X[55], Y[55];

double dist(int a, int b) {
    return (sqrt((X[a] - X[b]) * (X[a] - X[b]) + (Y[a] - Y[b]) * (Y[a] - Y[b])));
}

int main() {
    int N;
    
    cin >> N;
    for (int i = 0; i < N; i++) cin >> X[i] >> Y[i];
    
    if (N == 2) {
        printf("%.12f\n", dist(0, 1) / 2);
        return (0);
    }
    double minv = 100000000;
    for (int i = 0; i < N; i++) {
        for (int j = i + 1; j < N; j++) { 
            for (int k = j + 1; k < N; k++) {
                double a = dist(j, k), b = dist(k, i), c = dist(i, j);
                double dda = a * a * (b * b + c * c - a * a);
                double ddb = b * b * (c * c + a * a - b * b);
                double ddc = c * c * (a * a + b * b - c * c);
                double bb = dda + ddb + ddc;

                double x = dda * X[i] + ddb * X[j] + ddc * X[k];
                double y = dda * Y[i] + ddb * Y[j] + ddc * Y[k];
                x /= bb, y /= bb;

                double r = sqrt((x - X[i]) * (x - X[i]) + (y - Y[i]) * (y - Y[i]));
                bool flag = true;
                for (int l = 0; l < N; l++) {
                    if (sqrt((x - X[l]) * (x - X[l]) + (y - Y[l]) * (y - Y[l])) > r + eps) {
                        flag = false;
                        break;
                    }
                }
                bool f[3] = { true,  true, true };
                for (int l = 0; l < N; l++) {
                    double dx = (X[i] + X[j]) / 2;
                    double dy = (Y[i] + Y[j]) / 2;
                    double d = dist(i, j) / 2;
                    if (sqrt((dx - X[l]) * (dx - X[l]) + (dy - Y[l]) * (dy - Y[l])) > r + eps) {
                        f[0] = false;
                        break;
                    }
                    dx = (X[j] + X[k]) / 2;
                    dy = (Y[j] + Y[k]) / 2;
                    d = dist(j, k) / 2;
                    if (sqrt((dx - X[l]) * (dx - X[l]) + (dy - Y[l]) * (dy - Y[l])) > r + eps) {
                        f[1] = false;
                        break;
                    }
                    dx = (X[k] + X[i]) / 2;
                    dy = (Y[k] + Y[i]) / 2;
                    d = dist(k, i) / 2;
                    if (sqrt((dx - X[l]) * (dx - X[l]) + (dy - Y[l]) * (dy - Y[l])) > r + eps) {
                        f[2] = false;
                        break;
                    }
                }
                if (flag) minv = min(minv, r);
                if (f[0]) minv = dist(i, j) / 2;
                if (f[1]) minv = dist(j, k) / 2;
                if (f[2]) minv = dist(k, i) / 2;
            }
        }
    }
    printf("%.12f\n", minv);
    return (0);
}