Problem:
キョウトという街は古い寺社仏閣で有名な観光地である。
イクタ君は数人の友人とキョウト観光に来ていたが、全員が好き勝手に行動した結果、みんな迷子になってしまった。
そこでイクタ君は、なるべく早く全員と合流するためには集合場所をどこにするのがよいか考えることにした。
キョウトの道路は東西と南北に距離10の間隔で無数に走っており、無限に広がる正方格子とみなすことができる。
道路は直線であるとみなし、幅は無いものとする。
また、街の中心を基準として東に距離
x
、北に距離
y
移動した位置を
(x,y)
という座標で表す。
街の中心である
(0,0)
では東西の道路と南北の道路が交差している。
下図はキョウトの道路と、いくつかの点の座標を図示したものである。
N
人の観光客の座標
(X
i
,Y
i
)
が整数で与えられるので、
N
人が道路上を移動して1点に集合するのに必要な時間の最小値を答えよ。
観光客は時間1あたり距離1の速さで連続的に道路上を動くことができるとする。
与えられる
N
人の観光客の座標はそれぞれ相異なり、また全ての座標は道路上にあることが保証されている。
また、複数の観光客が同時に1点に存在したり、観光客同士がすれ違うように移動することも可能であるとする。
Input
入力は以下の形式で与えられる。
N
X
1
Y
1
...
X
N
Y
N
1行目のNは観光客の人数である。
次のN行のうちi行目(
1≤ i ≤ N
)はi番目の観光客の位置
(X
i
, Y
i
)
を表している。
X
i
,
Y
i
はそれぞれ整数で与えられる。
Constraints
入力中の各変数は以下の制約を満たす。
2 ≤ N ≤ 10000
−10
8
≤ X
i
, Y
i
≤ 10
8
i ≠ j
のとき
(X
i
, Y
i
) ≠ (X
j
, Y
j
)
X
i
と
Y
i
のうち少なくとも一方は10の倍数である
Output
問題の解を1行に出力せよ。
10
−3
までの絶対誤差を許容する。
Sample Input 1
3
5 10
-10 0
3 -10
Output for the Sample Input 1
14
(0, 1)
に集合すればよい（この入力例は問題文中の図と対応している）
Sample Input 2
2
0 0
0 1
Output for the Sample Input 2
0.5
(0, 0.5)
に集合すればよい（整数座標以外に集まる場合もあることに注意せよ）
Sample Input 3
4
100000000 100000000
100000000 -100000000
-100000000 100000000
-100000000 -100000000
Output for the Sample Input 3
200000000

Submitted solutions:

code_snippet: #include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = (int)(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = (int)(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define REVERSE(x) reverse((x).begin(), (x).end())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << '\n'

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-10;

constexpr int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
constexpr int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

template<typename T>
bool chmax(T& a, T b){
    if(a < b){
        a = b;
        return true;
    }
    return false;
}

template<typename T>
bool chmin(T& a, T b){
    if(b < a){
        a = b;
        return true;
    }
    return false;
}

lint dist(lint x1, lint y1, lint x2, lint y2){
    if(x1 / 20 == x2 / 20){
        return abs(y1 - y2) + min(x1 % 20 + x2 % 20, (20 - x1 % 20) + (20 - x2 % 20));
    }else if(y1 / 20 == y2 / 20){
        return abs(x1 - x2) + min(y1 % 20 + y2 % 20, (20 - y1 % 20) + (20 - y2 % 20));
    }
    return abs(x1 - x2) + abs(y1 - y2);
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    int n;
    cin >> n;

    vector<lint> x(n), y(n);
    for(int i = 0 ; i < n ; ++i){
        cin >> x[i] >> y[i];
        x[i] *= 2;
        y[i] *= 2;
    }

    lint xr1 = LLINF;
    lint xr2 = -LLINF;
    lint yr1 = LLINF;
    lint yr2 = -LLINF;

    for(int i = 0 ; i < n ; ++i){
        xr1 = min(xr1, x[i] + y[i]);
        xr2 = max(xr2, x[i] + y[i]);
        yr1 = min(yr1, x[i] - y[i]);
        yr2 = max(yr2, x[i] - y[i]);
    }

    lint gxr = (xr1 + xr2) / 2;
    lint gyr = (yr1 + yr2) / 2;

    lint gxc = (gxr + gyr) / 2;
    gxc = gxc / 20 * 20 + 200000000;
    lint gyc = (gxr - gyr) / 2;
    gyc = gyc / 20 * 20 + 200000000;

    for(int i = 0 ; i < n ; ++i){
        x[i] += 200000000;
        y[i] += 200000000;
    }

    lint ans2 = LLINF;

    for(lint gx = gxc - 20 ; gx < gxc + 40 ; ++gx){
        for(lint gy = gyc - 20 ; gy < gyc + 40 ; gy += 20){
            lint tmp = 0;

            for(int i = 0 ; i < n ; ++i){
                tmp = max(tmp, dist(gx, gy, x[i], y[i]));
            }

            ans2 = min(ans2, tmp);
        }
    }

    for(lint gx = gxc - 20 ; gx < gxc + 40 ; gx += 20){
        for(lint gy = gyc - 20 ; gy < gyc + 40 ; ++gy){
            lint tmp = 0;

            for(int i = 0 ; i < n ; ++i){
                tmp = max(tmp, dist(gx, gy, x[i], y[i]));
            }

            ans2 = min(ans2, tmp);
        }
    }

    double ans = (double)ans2 * 0.5;
    cout << ans << endl;

    cout << flush;

    return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3724
final_rank: 6

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

using namespace std;

#define rep(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rrep(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define ALL(v) (v).begin(), (v).end()
#define UNIQUE(v) sort(ALL(v)), (v).erase(unique(ALL(v)), (v).end())
#define SZ(v) (int)v.size()
#define MIN(v) *min_element(ALL(v))
#define MAX(v) *max_element(ALL(v))
#define LB(v, x) int(lower_bound(ALL(v), (x)) - (v).begin())
#define UB(v, x) int(upper_bound(ALL(v), (x)) - (v).begin())

using uint = unsigned int;
using ll = long long int;
using ull = unsigned long long;
using i128 = __int128_t;
using u128 = __uint128_t;
const int inf = 0x3fffffff;
const ll INF = 0x1fffffffffffffff;

template <typename T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T, typename U> T ceil(T x, U y) {
    assert(y != 0);
    if (y < 0)
        x = -x, y = -y;
    return (x > 0 ? (x + y - 1) / y : x / y);
}
template <typename T, typename U> T floor(T x, U y) {
    assert(y != 0);
    if (y < 0)
        x = -x, y = -y;
    return (x > 0 ? x / y : (x - y + 1) / y);
}
template <typename T> int popcnt(T x) {
    return __builtin_popcountll(x);
}
template <typename T> int topbit(T x) {
    return (x == 0 ? -1 : 63 - __builtin_clzll(x));
}
template <typename T> int lowbit(T x) {
    return (x == 0 ? -1 : __builtin_ctzll(x));
}

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "P(" << p.first << ", " << p.second << ")";
    return os;
}
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &map_var) {
    os << "{";
    for (auto itr = map_var.begin(); itr != map_var.end(); itr++) {
        os << "(" << itr->first << ", " << itr->second << ")";
        itr++;
        if (itr != map_var.end())
            os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
template <typename T> ostream &operator<<(ostream &os, const set<T> &set_var) {
    os << "{";
    for (auto itr = set_var.begin(); itr != set_var.end(); itr++) {
        os << *itr;
        ++itr;
        if (itr != set_var.end())
            os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
#ifdef LOCAL
#define show(...) _show(0, #__VA_ARGS__, __VA_ARGS__)
#else
#define show(...) true
#endif
template <typename T> void _show(int i, T name) {
    cerr << '\n';
}
template <typename T1, typename T2, typename... T3>
void _show(int i, const T1 &a, const T2 &b, const T3 &...c) {
    for (; a[i] != ',' && a[i] != '\0'; i++)
        cerr << a[i];
    cerr << ":" << b << " ";
    _show(i + 1, a, c...);
}

/**
 * @brief template
 */

ll Dist(ll X1, ll Y1, ll X2, ll Y2) {
    X1 += 1e9;
    Y1 += 1e9;
    X2 += 1e9;
    Y2 += 1e9;
    if (X2 % 20 == 0 && Y1 % 20 == 0) {
        return abs(X1-X2) + abs(Y1-Y2);
    }
    if (X1 % 20 == 0 && Y2 % 20 == 0) {
        return abs(X1-X2) + abs(Y1-Y2);
    }
    if (X1 % 20 == 0 && X1 == X2) {
        return abs(X1-X2) + abs(Y1-Y2);
    }
    if (Y1 % 20 == 0 && Y1 == Y2) {
        return abs(X1-X2) + abs(Y1-Y2);
    }
    if (X1 % 20 == 0) {
        if (Y1 / 20 == Y2 / 20) {
            ll y1 = Y1 % 20, y2 = Y2 % 20;
            return min(y1+y2, 40-y1-y2) + abs(X1-X2);
        }
        else return abs(X1-X2) + abs(Y1-Y2);
    }
    if (Y1 % 20 == 0) {
        if (X1 / 20 == X2 / 20) {
            ll x1 = X1 % 20, x2 = X2 % 20;
            return min(x1+x2, 40-x1-x2) + abs(Y1-Y2);
        }
        else return abs(X1-X2) + abs(Y1-Y2);
    }
    return (ll)inf;
}

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<ll> X(N), Y(N);
    vector<ll> A(N), B(N);
    rep(i,0,N) {
        cin >> X[i] >> Y[i];
        X[i] *= 2, Y[i] *= 2;
        A[i] = X[i] + Y[i];
        B[i] = X[i] - Y[i];
    }
    sort(ALL(A)), sort(ALL(B));
    ll AC = (A[0]+A.back())/2;
    ll BC = (B[0]+B.back())/2;
    ll XC = (AC+BC)/2;
    ll YC = (AC-BC)/2;
    ll ANS = INF;
    rep(dx,-100,100) {
        rep(dy,-100,100) {
            ll NX = XC + dx, NY = YC + dy;
            if (NX % 20 != 0 && NY % 20 != 0) continue;
            ll MAX = 0;
            rep(i,0,N) chmax(MAX, Dist(X[i],Y[i],NX,NY));
            chmin(ANS, MAX);
        }
    }
    printf("%.12f\n", (double)ANS * 0.5);
}
accuracy: 1
time_ms: 370
memory_kb: 3912
final_rank: 11

code_snippet: #include<bits/stdc++.h>
using namespace std;
using ll = long long;

bool is_ten(double a){
    return (abs(round(a/10.0)*10.0-a)<1e-8);
}
double dist(double X,double Y,double x,double y){
    if(is_ten(Y)&&is_ten(y))swap(X,Y),swap(x,y);
    if(is_ten(X)&&is_ten(x)){
        if(abs(X-x)<1e-8||floor(Y/10)!=floor(y/10))return abs(X-x)+abs(Y-y);
        else {
            double b=floor(Y/10)*10;
            double my=min(Y-b+y-b,(b+10)-Y+(b+10)-y);
            return abs(X-x)+my;
        }
    }
    else return abs(X-x)+abs(Y-y);
}

int main() {

    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int N;
    cin>>N;
    vector<pair<double,double>> P(N);
    for(int i=0;i<N;i++){
        cin>>P[i].first>>P[i].second;
        P[i].first+=1e8+100;
        P[i].second+=1e8+100;
    }
    double an=1e18;
        vector<double> U={1e18,-1e18,1e18,-1e18};
        for(int i=0;i<N;i++){
            U[0]=min(U[0],P[i].first+P[i].second);
            U[1]=max(U[1],P[i].first+P[i].second);
            U[2]=min(U[2],P[i].first-P[i].second);
            U[3]=max(U[3],P[i].first-P[i].second);
        }
        double lx=(U[0]+U[1])/double(2);
        double ly=(U[2]+U[3])/double(2);
        double px=(lx+ly)/2.0;
        double py=(lx-ly)/2.0;
        swap(lx,px);
        swap(ly,py);
        lx=floor(lx/10.0)*10.0;
        ly=floor(ly/10.0)*10.0;
        for(double x=lx-10;x<=lx+10;x+=10){
            for(double y=ly-10;y<=ly+10;y+=0.5){
                double res=0.0;
                for(int i=0;i<N;i++)res=max(res,dist(x,y,P[i].first,P[i].second));
                an=min(an,res);
            }
        }
        for(double y=ly-10;y<=ly+10;y+=10){
            for(double x=lx-10;x<=lx+10;x+=0.5){
                double res=0.0;
                for(int i=0;i<N;i++)res=max(res,dist(x,y,P[i].first,P[i].second));
                an=min(an,res);
            }
        }
    
    cout<<fixed<<setprecision(15)<<an<<endl;
}
accuracy: 1
time_ms: 40
memory_kb: 3584
final_rank: 4

code_snippet: #include<bits/stdc++.h>
using namespace std;
using ll = long long;

bool is_ten(double a){
    double d=round(a/10.0)*10.0;
    return (abs(d-a)<1e-8);
}
double dist(double X,double Y,double x,double y){
    if(is_ten(X)&&is_ten(x)){
        if(abs(X-x)<1e-8||floor(Y/10)!=floor(y/10))return abs(X-x)+abs(Y-y);
        else {
            double b=floor(Y/10)*10;
            double my=min(Y-b+y-b,(b+10)-Y+(b+10)-y);
            return abs(X-x)+my;
        }
    }
    else if(is_ten(Y)&&is_ten(y)){
        swap(X,Y);
        swap(x,y);
        if(abs(X-x)<1e-8||floor(Y/10)!=floor(y/10))return abs(X-x)+abs(Y-y);
        else {
            double b=floor(Y/10)*10;
            double my=min(Y-b+y-b,(b+10)-Y+(b+10)-y);
            return abs(X-x)+my;
        }
    }
    else{
        return abs(X-x)+abs(Y-y);
    }
}

int main() {

    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int N;
    cin>>N;
    vector<pair<double,double>> P(N);
    for(int i=0;i<N;i++){
        cin>>P[i].first>>P[i].second;
        P[i].first+=1e8+100;
        P[i].second+=1e8+100;
    }
    double an=1e18;
        vector<double> U(4,1e18);
        U[1]=U[3]=-1e18;
        for(int i=0;i<N;i++){
            U[0]=min(U[0],P[i].first+P[i].second);
            U[1]=max(U[1],P[i].first+P[i].second);
            U[2]=min(U[2],P[i].first-P[i].second);
            U[3]=max(U[3],P[i].first-P[i].second);
        }
        double lx=(U[0]+U[1])/double(2);
        double ly=(U[2]+U[3])/double(2);
        double px=(lx+ly)/2.0;
        double py=(lx-ly)/2.0;
        swap(lx,px);
        swap(ly,py);
        lx=floor(lx/10.0)*10.0;
        ly=floor(ly/10.0)*10.0;
        for(double x=lx-10;x<=lx+10;x+=10){
            for(double y=ly-10;y<=ly+10;y+=0.5){
                double res=0.0;
                for(int i=0;i<N;i++){
                    res=max(res,dist(x,y,P[i].first,P[i].second));
                }
                an=min(an,res);
            }
        }
        for(double y=ly-10;y<=ly+10;y+=10){
            for(double x=lx-10;x<=lx+10;x+=0.5){
                double res=0.0;
                for(int i=0;i<N;i++){
                    res=max(res,dist(x,y,P[i].first,P[i].second));
                }
                an=min(an,res);
            }
        }
    
    cout<<fixed<<setprecision(15)<<an<<endl;
}
accuracy: 1
time_ms: 40
memory_kb: 3580
final_rank: 3

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

const long long INF = 3LL << 59;
const int D = 20;

struct point {
	long long x, y;
};

long long get(long long x) {
	return (x >= 0 ? x / D : -((-x + D - 1) / D));
}

long long dist(const point& p1, const point& p2) {
	if (p1.x % D == 0 && p2.x % D == 0 && p1.x != p2.x && get(p1.y) == get(p2.y)) {
		int s1 = p1.y - get(p1.y) * D;
		int s2 = p2.y - get(p2.y) * D;
		return abs(p1.x - p2.x) + min(s1 + s2, D * 2 - (s1 + s2));
	}
	if (p1.y % D == 0 && p2.y % D == 0 && p1.y != p2.y && get(p1.x) == get(p2.x)) {
		int s1 = p1.x - get(p1.x) * D;
		int s2 = p2.x - get(p2.x) * D;
		return abs(p1.y - p2.y) + min(s1 + s2, D * 2 - (s1 + s2));
	}
	return abs(p1.x - p2.x) + abs(p1.y - p2.y);
}

long long solve(int N, const vector<point>& P) {
	array<long long, 8> bounds = { +INF, -INF, +INF, -INF, +INF, -INF, +INF, -INF };
	for (int i = 0; i < N; i++) {
		bounds[0] = min(bounds[0], P[i].x);
		bounds[1] = max(bounds[1], P[i].x);
		bounds[2] = min(bounds[2], P[i].y);
		bounds[3] = max(bounds[3], P[i].y);
		bounds[4] = min(bounds[4], P[i].x - P[i].y);
		bounds[5] = max(bounds[5], P[i].x - P[i].y);
		bounds[6] = min(bounds[6], P[i].x + P[i].y);
		bounds[7] = max(bounds[7], P[i].x + P[i].y);
	}
	long long sw = bounds[4] - bounds[5] + 1;
	long long sh = bounds[6] - bounds[7] + 1;
	long long l = -1, r = (bounds[1] - bounds[0]) + (bounds[3] - bounds[2]) + 100;
	while (r - l > 1) {
		long long m = (l + r) / 2;
		long long area = (sw + 2 * m >= 0 && sh + 2 * m >= 0 ? (sw + 2 * m) * (sh + 2 * m) : 0);
		if (area >= 7200) {
			r = m;
		}
		else {
			l = m;
		}
	}
	long long ans = r;
	for (long long i = bounds[5] - l; i <= bounds[4] + l; i++) {
		for (long long j = bounds[7] - l; j <= bounds[6] + l; j++) {
			// x - y = i, x + y = j
			if ((i & 1) == (j & 1)) {
				point p = point{(i + j) / 2, (j - i) / 2};
				if (p.x % D == 0 || p.y % D == 0) {
					long long subans = 0;
					for (int k = 0; k < N; k++) {
						subans = max(subans, dist(p, P[k]));
					}
					ans = min(ans, subans);
				}
			}
		}
	}
	return ans;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<point> P(N);
	for (int i = 0; i < N; i++) {
		cin >> P[i].x >> P[i].y;
		P[i].x *= 2;
		P[i].y *= 2;
	}
	long long ans = solve(N, P);
	cout << ans / 2 << "." << ans % 2 * 5 << endl;
	return 0;
}
accuracy: 1
time_ms: 90
memory_kb: 3476
final_rank: 2

code_snippet: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=300005,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;cin>>N;
    vector<ll> X(N),Y(N);
    vector<ll> A(N),B(N);
    for(int i=0;i<N;i++){
        cin>>X[i]>>Y[i];
        X[i]*=2;
        Y[i]*=2;
        A[i]=X[i]-Y[i];
        B[i]=X[i]+Y[i];
    }
    sort(all(A));
    sort(all(B));
    ll need=max(A.back()-A.front(),B.back()-B.front())/2;
    ll mA=(A.front()+A.back())/2,mB=(B.front()+B.back())/2;
    ll mX=(mA+mB)/2,mY=(mB-mA)/2;
    
    vector<pair<ll,ll>> miru;
    
    for(int a=-20;a<=20;a++){
        for(int b=-20;b<=20;b++){
            ll x=mX+a,y=mY+b;
            bool f=false;
            if(abs(x)%20==0) f=true;
            if(abs(y)%20==0) f=true;
            if(f) miru.push_back(mp(x,y));
        }
    }
    
    //cout<<mX<<" "<<mY<<endl;
    //cout<<need<<endl;
    
    //for(auto a:miru) cout<<a.fi<<" "<<a.se<<endl;
    
    int M=si(miru);
    
    auto dd=[&](ll x1,ll y1,ll x2,ll y2){
        x1+=600000000;
        y1+=600000000;
        x2+=600000000;
        y2+=600000000;
        
        ll ans=1LL<<50;
        
        for(ll a=x1/20-1;a<=x1/20+1;a++){
            for(ll b=y1/20-1;b<=y1/20+1;b++){
                for(ll c=x2/20-1;c<=x2/20+1;c++){
                    for(ll d=y2/20-1;d<=y2/20+1;d++){
                        ll cost=0;
                        cost+=abs(a*20-x1);
                        cost+=abs(b*20-y1);
                        cost+=abs(c*20-x2);
                        cost+=abs(d*20-y2);
                        cost+=abs(a-c)*20;
                        cost+=abs(b-d)*20;
                        chmin(ans,cost);
                    }
                }
            }
        }
        
        if(x1==x2&&x1%20==0) chmin(ans,abs(y2-y1));
        if(y1==y2&&y1%20==0) chmin(ans,abs(x2-x1));
        
        return ans;
    };
    
    auto check=[&](ll T){
        vector<int> cn(M);
        for(int i=0;i<N;i++){
            for(int j=0;j<M;j++){
                if(dd(X[i],Y[i],miru[j].fi,miru[j].se)<=T) cn[j]++;
            }
        }
        
        for(int j=0;j<M;j++){
            if(cn[j]==N){
                //cout<<miru[j].fi<<" "<<miru[j].se<<endl;
                return true;
            }
        }
        
        return false;
    };
    
    for(ll i=need;;i++){
        if(check(i)){
            cout<<fixed<<setprecision(25)<<(double)(i)/2<<"\n";
            return 0;
        }
    }
}
accuracy: 1
time_ms: 310
memory_kb: 3900
final_rank: 10

code_snippet: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=300005,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;cin>>N;
    vector<ll> X(N),Y(N);
    vector<ll> A(N),B(N);
    for(int i=0;i<N;i++){
        cin>>X[i]>>Y[i];
        X[i]*=2;
        Y[i]*=2;
        A[i]=X[i]-Y[i];
        B[i]=X[i]+Y[i];
    }
    sort(all(A));
    sort(all(B));
    ll need=max(A.back()-A.front(),B.back()-B.front())/2;
    ll mA=(A.front()+A.back())/2,mB=(B.front()+B.back())/2;
    ll mX=(mA+mB)/2,mY=(mB-mA)/2;
    
    vector<pair<ll,ll>> miru;
    
    for(int a=-20;a<=20;a++){
        for(int b=-20;b<=20;b++){
            ll x=mX+a,y=mY+b;
            bool f=false;
            if(abs(x)%20==0) f=true;
            if(abs(y)%20==0) f=true;
            if(f) miru.push_back(mp(x,y));
        }
    }
    
    //cout<<mX<<" "<<mY<<endl;
    
    //for(auto a:miru) cout<<a.fi<<" "<<a.se<<endl;
    
    int M=si(miru);
    
    auto dd=[&](ll x1,ll y1,ll x2,ll y2){
        x1+=600000000;
        y1+=600000000;
        x2+=600000000;
        y2+=600000000;
        
        ll ans=1LL<<50;
        
        for(ll a=x1/20-1;a<=x1/20+1;a++){
            for(ll b=y1/20-1;b<=y1/20+1;b++){
                for(ll c=x2/20-1;c<=x2/20+1;c++){
                    for(ll d=y2/20-1;d<=y2/20+1;d++){
                        ll cost=0;
                        cost+=abs(a*20-x1);
                        cost+=abs(b*20-y1);
                        cost+=abs(c*20-x2);
                        cost+=abs(d*20-y2);
                        cost+=abs(a-c)*20;
                        cost+=abs(b-d)*20;
                        chmin(ans,cost);
                    }
                }
            }
        }
        
        return ans;
    };
    
    auto check=[&](ll T){
        vector<int> cn(M);
        for(int i=0;i<N;i++){
            for(int j=0;j<M;j++){
                if(dd(X[i],Y[i],miru[j].fi,miru[j].se)<=T) cn[j]++;
            }
        }
        
        for(int j=0;j<M;j++){
            if(cn[j]==N){
                //cout<<miru[j].fi<<" "<<miru[j].se<<endl;
                return true;
            }
        }
        
        return false;
    };
    
    for(ll i=need;;i++){
        if(check(i)){
            cout<<fixed<<setprecision(25)<<(double)(i)/2<<"\n";
            return 0;
        }
    }
}
accuracy: 0.8805970149253731
time_ms: 240
memory_kb: 3896
final_rank: 16

code_snippet: #pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#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<unordered_set>
#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 = 998244353;
const ll INF = mod * mod;
typedef pair<int, int>P;

#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 long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-8;
const ld pi = acosl(-1.0);

ll mod_pow(ll x, ll n, ll m = mod) {
	if (n < 0) {
		ll res = mod_pow(x, -n, m);
		return mod_pow(res, m - 2, m);
	}
	if (abs(x) >= m)x %= m;
	if (x < 0)x += m;
	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)); }
modint operator/=(modint& a, modint b) { a = a / b; return a; }
const int max_n = 1 << 2;
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];
}
modint combP(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[a - b];
}

const int mn = 10000005;
int calc(vector<int> x, vector<int> y) {
	int n = x.size();
	auto to20 = [&](int x) {
		int res = x % 20; if (res < 0)res += 20;
		return res;
	};
	auto loc20 = [&](int x) {
		return (x - to20(x)) / 20;
	};
	vector<int> x20(n), y20(n);
	rep(i, n) {
		x20[i] = to20(x[i]);
		y20[i] = to20(y[i]);
	}
	vector<int> xt(n), yt(n);
	rep(i, n) {
		xt[i] = loc20(x[i]);
		yt[i] = loc20(y[i]);
	}
	auto dist = [&](int cx, int cy) {
		int res = 0;
		//cnt++;
		int cxr = to20(cx);
		int cyr = to20(cy);
		int cxt = loc20(cx);
		int cyt = loc20(cy);
		rep(id, n) {
			int val;
			if (cy != y[id] && x20[id] && cxr && xt[id] == cxt) {
				val = abs(cy - y[id]);
				int r1 = cxr;
				int r2 = x20[id];
				val += min(r1 + r2, 40 - (r1 + r2));
			}
			else if (cx != x[id] && y20[id] && cyr && yt[id] == cyt) {
				val = abs(cx - x[id]);
				int r1 = cyr;
				int r2 = y20[id];
				val += min(r1 + r2, 40 - (r1 + r2));
			}
			else {
				val = abs(cx - x[id]) + abs(cy - y[id]);
			}
			//val = abs(cx - x[id]) + abs(cy - y[id]);

			res = max(res, val);
		}
		return res;
	};
	auto calcy = [&](int cy) {
		int le = -20 * mn, ri = 20 * mn;
		while (ri - le > 3) {
			int m1 = (le + ri) / 2;
			int m2 = m1 + 1;
			int c1 = dist(m1, cy);
			int c2 = dist(m2, cy);
			if (c1 < c2)ri = m2;
			else le = m1;
		}
		int res = -1;
		Rep1(j, le, ri) {
			int val = dist(j, cy);
			if (res < 0 || val < res)res = val;
		}
		return res;
	};
	int le = -mn, ri = mn;
	while (ri - le > 3) {
		int m1 = (le + ri) / 2;
		int m2 = m1 + 1;
		int c1 = calcy(m1*20);
		int c2 = calcy(m2*20);
		if (c1 < c2)ri = m2;
		else le = m1;
	}
	int res = -1;
	Rep1(j, le, ri) {
		int val = calcy(20*j);
		if (res < 0 || val < res)res = val;
	}
	return res;
}
void solve() {
	int n; cin >> n;
	vector<int> x(n), y(n);
	rep(i, n) {
		cin >> x[i] >> y[i];
		x[i] *= 2;
		y[i] *= 2;
	}
	int ans1 = calc(x, y);
	int ans2 = calc(y,x);
	int ans = min(ans1, ans2);
	cout << ans / 2;
	if (ans % 2)cout << ".5";
	cout << "\n";

	//cout << cnt << "\n";
}


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(8);
	//init_f();
	//init();
	//int t; cin >> t; rep(i, t)
	solve();
	return 0;
}
accuracy: 1
time_ms: 230
memory_kb: 3568
final_rank: 8

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

using namespace std;

int main() {
  int N;
  cin >> N;
  vector< int > X(N), Y(N), x(N), y(N);
  for(int i = 0; i < N; i++) {
    cin >> x[i] >> y[i];
    x[i] *= 2;
    y[i] *= 2;
    X[i] = x[i] + y[i];
    Y[i] = x[i] - y[i];
  }
  auto f = minmax_element(begin(X), end(X));
  auto g = minmax_element(begin(Y), end(Y));
  int mx = (*f.second + *f.first) / 2;
  int my = (*g.second + *g.first) / 2;
  int xx = (mx + my) / 2;
  int yy = (mx - my) / 2;
  int ret = 1e9;
  auto solve = [](int a, int b, int c, int d) {
    a += 2e8, b += 2e8, c += 2e8, d += 2e8;
    if(a % 20 == 0 and a == c) {
      return abs(b - d);
    }
    if(b % 20 == 0 and b == d) {
      return abs(a - c);
    }
    if(a % 20 == 0 and c % 20 == 0 and b / 20 == d / 20) {
      return abs(a - c) + min(b % 20 + d % 20, 40 - b % 20 - d % 20);
    }
    if(b % 20 == 0 and d % 20 == 0 and a / 20 == c / 20) {
      return abs(b - d) + min(a % 20 + c % 20, 40 - a % 20 - c % 20);
    }
    return abs(a - c) + abs(b - d);
  };
  for(int i = xx - 40; i <= xx + 40; i++) {
    for(int j = yy - 40; j <= yy + 40; j++) {
      if(i % 20 and j % 20) continue;
      int sub = 0;
      for(int k = 0; k < N; k++) {
        sub = max(sub, solve(i, j, x[k], y[k]));
      }
      ret = min(ret, sub);
    }
  }
  cout << fixed << setprecision(1) << ret * .5 << endl;
}
accuracy: 1
time_ms: 60
memory_kb: 3692
final_rank: 7

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

using namespace std;

int main() {
  int N;
  cin >> N;
  vector< int > X(N), Y(N), x(N), y(N);
  for(int i = 0; i < N; i++) {
    cin >> x[i] >> y[i];
    x[i] *= 2;
    y[i] *= 2;
    X[i] = x[i] + y[i];
    Y[i] = x[i] - y[i];
  }
  auto f = minmax_element(begin(X), end(X));
  auto g = minmax_element(begin(Y), end(Y));
  int mx = (*f.second + *f.first) / 2;
  int my = (*g.second + *g.first) / 2;
  int xx = (mx + my) / 2;
  int yy = (mx - my) / 2;
  int ret = 1e9;
  auto solve = [](int a, int b, int c, int d) {
    a += 2e8, b += 2e8, c += 2e8, d += 2e8;
    if(a % 20 == 0 and c % 20 == 0 and b / 20 == d / 20) {
      return abs(a - c) + min(b % 20 + d % 20, 40 - b % 20 - d % 20);
    }
    if(b % 20 == 0 and d % 20 == 0 and a / 20 == c / 20) {
      return abs(b - d) + min(a % 20 + c % 20, 40 - a % 20 - c % 20);
    }
    return abs(a - c) + abs(b - d);
  };
  for(int i = xx - 40; i <= xx + 40; i++) {
    for(int j = yy - 40; j <= yy + 40; j++) {
      if(i % 20 and j % 20) continue;
      int sub = 0;
      for(int k = 0; k < N; k++) {
        sub = max(sub, solve(i, j, x[k], y[k]));
      }
      ret = min(ret, sub);
    }
  }
  cout << fixed << setprecision(1) << ret * .5 << endl;
}
accuracy: 0.8805970149253731
time_ms: 50
memory_kb: 3692
final_rank: 15

code_snippet: // clang-format off
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
//#define double __float80
using namespace std;
#define fi first
#define se second
#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; i++)
#define rep2(i, a, b) for (int i = (int)(a), i##_len=(b); i < i##_len; i++)
#define rep3(i, a, b) for (int i = (int)(a), i##_len=(b); i >= i##_len; i--)
#define rfor(i, a) for (auto &i: a)
#define all(obj) begin(obj), end(obj)
#define _max(x) *max_element(all(x))
#define _min(x) *min_element(all(x))
#define _sum(x) accumulate(all(x), 0LL)

const int MOD   = 1000000007;
const double INF    = 1e18;
const double EPS = 1e-20;
const double PI  = 3.14159265358979;
template <class T> using V = vector<T>;
template <class T> using VV = vector<vector<T>>;
template <class T> using VVV = vector<vector<vector<T>>>;
template <class T, class S>  using P = pair<T, S>;
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b;return true;}return false;}
template<class T> bool chmin(T &a, const T &b) {if (b < a) {a = b;return true;}return false;}
int _ceil(int a, int b) { return (a >= 0 ? (a + (b - 1)) / b : (a - (b - 1)) / b); }
template<class T> T chmod(T &a, T mod=MOD) {a =  a >= 0 ? a % mod : a - (mod * _ceil(a, mod)); return a;};
int _mod(int a, int mod=MOD) {return a >= 0 ? a % mod : a - (mod * _ceil(a, mod));}
double mod(double a, int mod = MOD) { return fmod(a, mod) >= 0 ? fmod(a, mod) : fmod(a, mod) + mod; }
int _pow(int a, int b, int mod=MOD) {int res = 1;for (a %= mod; b; a = a * a % mod, b >>= 1)if (b & 1) res = res * a % mod;return res;}
vector<int> iota(int n){vector<int> ret(n); iota(begin(ret), end(ret), 0); return ret;}
struct mint {long long x;mint(long long x = 0): x((x % MOD + MOD) % MOD) {}mint operator-() const { return mint(-x); }mint &operator+=(const mint a) {if ((x += a.x) >= MOD) x -= MOD;return *this;}mint &operator-=(const mint a) {if ((x += MOD - a.x) >= MOD) x -= MOD;return *this;}mint &operator*=(const mint a) {(x *= a.x) %= MOD;return *this;}mint operator+(const mint a) const { return mint(*this) += a; }mint operator-(const mint a) const { return mint(*this) -= a; }mint operator*(const mint a) const { return mint(*this) *= a; }mint pow(long long n) const {mint ret(1), mul(x);while (n > 0) {if (n & 1) ret *= mul;mul *= mul;n >>= 1;}return ret;}mint inv() const {int a = x, b = MOD, u = 1, v = 0, t;while (b > 0) {t = a / b;swap(a -= t * b, b);swap(u -= t * v, v);}return mint(u);}mint &operator/=(const mint a) { return *this *= a.inv(); }mint operator/(const mint a) const { return mint(*this) /= a; }bool operator==(const mint a) const { return x == a.x; }bool operator!=(const mint a) const { return x != a.x; }friend istream &operator>>(istream &is, mint &a) { return is >> a.x; }friend ostream &operator<<(ostream &os, const mint &a) { return os << a.x; }};
// clang-format on


template<class T> vector<vector<T>> rotate_45_degree(vector<vector<T>> &xy) { // 45度回転
  vector<vector<T>> ret(xy.size(), vector<T>(2));
  for (int i = 0; i < xy.size(); i++) {
    ret[i][0] = xy[i][0] - xy[i][1] == 0 ? 0 : (xy[i][0] - xy[i][1]) / (sqrt(2));
    ret[i][1] = xy[i][0] + xy[i][1] == 0 ? 0 : (xy[i][0] + xy[i][1]) / (sqrt(2));
  }
  return ret;
};

double calc_max_dis(double x, double y, VV<double> &xy) {
  double ret = 0;
  rfor(i, xy) {
    double temp = abs(i[0] - x) + abs(i[1] - y);
    if (mod(i[1], 10) == 0 and mod(y, 10) == 0 and i[1] != y and (i[0] - mod(i[0], 10)) == (x - mod(x, 10))) {
      temp += 2 * min({mod(i[0], 10), mod(x, 10), 10 - mod(i[0], 10), 10 - mod(x, 10)});
    }
    if (mod(i[0], 10) == 0 and mod(x, 10) == 0 and i[0] != x and (i[1] - mod(i[1], 10)) == (y - mod(y, 10))) {
      temp += 2 * min({mod(i[1], 10), mod(y, 10), 10 - mod(i[1], 10), 10 - mod(y, 10)});
    }
    chmax(ret, temp);
  }
  return ret;
}

signed main() {
  cin.tie(nullptr);
  cout.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  int N;
  cin >> N;
  VV<double> xy(N, V<double>(2));
  rep(i, N) cin >> xy[i][0] >> xy[i][1];
  VV<double> rotated_xy = rotate_45_degree(xy);
  double x_max = -INF, x_min = INF, y_max = -INF, y_min = INF;
  rep(i, N) {
    chmax(x_max, rotated_xy[i][0]);
    chmax(y_max, rotated_xy[i][1]);
    chmin(x_min, rotated_xy[i][0]);
    chmin(y_min, rotated_xy[i][1]);
  }
  double X_rotated   = (x_max + x_min) / 2;
  double Y_rotated   = (y_max + y_min) / 2;
  double X           = (X_rotated + Y_rotated == 0) ? 0 : (X_rotated + Y_rotated) / sqrt(2);
  double Y           = (-X_rotated + Y_rotated == 0) ? 0 : (-X_rotated + Y_rotated) / sqrt(2);
  double minimum_dis = INF;
  for (double y = Y - mod(Y, 10); y <= Y + 10 - mod(Y, 10); y += 5e-1) {
    chmin(minimum_dis, calc_max_dis(X - mod(X, 10), y, xy));
    chmin(minimum_dis, calc_max_dis(X - mod(X, 10) + 10, y, xy));
  }
  for (double x = X - mod(X, 10); x <= X + 10 - mod(X, 10); x += 5e-1) {
    chmin(minimum_dis, calc_max_dis(x, Y - mod(Y, 10), xy));
    chmin(minimum_dis, calc_max_dis(x, Y - mod(Y, 10) + 10, xy));
  }
  cout << minimum_dis << endl;
}
accuracy: 1
time_ms: 330
memory_kb: 4384
final_rank: 13

code_snippet: // clang-format off
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
//#define double __float80
using namespace std;
#define fi first
#define se second
#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; i++)
#define rep2(i, a, b) for (int i = (int)(a), i##_len=(b); i < i##_len; i++)
#define rep3(i, a, b) for (int i = (int)(a), i##_len=(b); i >= i##_len; i--)
#define rfor(i, a) for (auto &i: a)
#define all(obj) begin(obj), end(obj)
#define _max(x) *max_element(all(x))
#define _min(x) *min_element(all(x))
#define _sum(x) accumulate(all(x), 0LL)

const int MOD   = 1000000007;
const double INF    = 1e18;
const double EPS = 1e-20;
const double PI  = 3.14159265358979;
template <class T> using V = vector<T>;
template <class T> using VV = vector<vector<T>>;
template <class T> using VVV = vector<vector<vector<T>>>;
template <class T, class S>  using P = pair<T, S>;
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b;return true;}return false;}
template<class T> bool chmin(T &a, const T &b) {if (b < a) {a = b;return true;}return false;}
int _ceil(int a, int b) { return (a >= 0 ? (a + (b - 1)) / b : (a - (b - 1)) / b); }
template<class T> T chmod(T &a, T mod=MOD) {a =  a >= 0 ? a % mod : a - (mod * _ceil(a, mod)); return a;};
int _mod(int a, int mod=MOD) {return a >= 0 ? a % mod : a - (mod * _ceil(a, mod));}
int _pow(int a, int b, int mod=MOD) {int res = 1;for (a %= mod; b; a = a * a % mod, b >>= 1)if (b & 1) res = res * a % mod;return res;}
vector<int> iota(int n){vector<int> ret(n); iota(begin(ret), end(ret), 0); return ret;}
struct mint {long long x;mint(long long x = 0): x((x % MOD + MOD) % MOD) {}mint operator-() const { return mint(-x); }mint &operator+=(const mint a) {if ((x += a.x) >= MOD) x -= MOD;return *this;}mint &operator-=(const mint a) {if ((x += MOD - a.x) >= MOD) x -= MOD;return *this;}mint &operator*=(const mint a) {(x *= a.x) %= MOD;return *this;}mint operator+(const mint a) const { return mint(*this) += a; }mint operator-(const mint a) const { return mint(*this) -= a; }mint operator*(const mint a) const { return mint(*this) *= a; }mint pow(long long n) const {mint ret(1), mul(x);while (n > 0) {if (n & 1) ret *= mul;mul *= mul;n >>= 1;}return ret;}mint inv() const {int a = x, b = MOD, u = 1, v = 0, t;while (b > 0) {t = a / b;swap(a -= t * b, b);swap(u -= t * v, v);}return mint(u);}mint &operator/=(const mint a) { return *this *= a.inv(); }mint operator/(const mint a) const { return mint(*this) /= a; }bool operator==(const mint a) const { return x == a.x; }bool operator!=(const mint a) const { return x != a.x; }friend istream &operator>>(istream &is, mint &a) { return is >> a.x; }friend ostream &operator<<(ostream &os, const mint &a) { return os << a.x; }};
// clang-format on

template<class T> vector<vector<T>> rotate_45_degree(vector<vector<T>> &xy) { // 45度回転
  vector<vector<T>> ret(xy.size(), vector<T>(2));
  for (int i = 0; i < xy.size(); i++) {
    ret[i][0] = xy[i][0] - xy[i][1] == 0 ? 0 : (xy[i][0] - xy[i][1]) / (sqrt(2));
    ret[i][1] = xy[i][0] + xy[i][1] == 0 ? 0 : (xy[i][0] + xy[i][1]) / (sqrt(2));
  }
  return ret;
};
double mod(double a, double b) {
  return fmod(a, b) >= 0 ? fmod(a, b) : fmod(a, b) + b;
}

double calc_max_dis(double x, double y, VV<double> &xy) {
  double ret = 0;
  rfor(i, xy) {
    double temp = abs(i[0] - x) + abs(i[1] - y);
    if (mod(i[1], 10) == 0 and mod(y, 10) == 0 and i[1] != y and (i[0] - mod(i[0], 10)) == (x - mod(x, 10))) {
      temp += 2 * min({mod(i[0], 10), mod(x, 10), 10 - mod(i[0], 10), 10 - mod(x, 10)});
    }
    if (mod(i[0], 10) == 0 and mod(x, 10) == 0 and i[0] != x and (i[1] - mod(i[1], 10)) == (y - mod(y, 10))) {
      temp += 2 * min({mod(i[1], 10), mod(y, 10), 10 - mod(i[1], 10), 10 - mod(y, 10)});
    }
    chmax(ret, temp);
  }
  return ret;
}

signed main() {
  cin.tie(nullptr);
  cout.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  int N;
  cin >> N;
  VV<double> xy(N, V<double>(2));
  rep(i, N) cin >> xy[i][0] >> xy[i][1];
  VV<double> rotated_xy = rotate_45_degree(xy);
  double x_max = -INF, x_min = INF, y_max = -INF, y_min = INF;
  rep(i, N) {
    chmax(x_max, rotated_xy[i][0]);
    chmax(y_max, rotated_xy[i][1]);
    chmin(x_min, rotated_xy[i][0]);
    chmin(y_min, rotated_xy[i][1]);
  }
  double X_rotated   = (x_max + x_min) / 2;
  double Y_rotated   = (y_max + y_min) / 2;
  double X           = (X_rotated + Y_rotated == 0) ? 0 : (X_rotated + Y_rotated) / sqrt(2);
  double Y           = (-X_rotated + Y_rotated == 0) ? 0 : (-X_rotated + Y_rotated) / sqrt(2);
  double minimum_dis = INF;
  for (double y = Y - mod(Y, 10); y <= Y + 10 - mod(Y, 10); y += 5e-1) {
    chmin(minimum_dis, calc_max_dis(X - mod(X, 10), y, xy));
    chmin(minimum_dis, calc_max_dis(X - mod(X, 10) + 10, y, xy));
  }
  for (double x = X - mod(X, 10); x <= X + 10 - mod(X, 10); x += 5e-1) {
    chmin(minimum_dis, calc_max_dis(x, Y - mod(Y, 10), xy));
    chmin(minimum_dis, calc_max_dis(x, Y - mod(Y, 10) + 10, xy));
  }
  cout << minimum_dis << endl;
}
accuracy: 1
time_ms: 320
memory_kb: 4380
final_rank: 12

code_snippet: // clang-format off
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
//#define double __float80
using namespace std;
#define fi first
#define se second
#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; i++)
#define rep2(i, a, b) for (int i = (int)(a), i##_len=(b); i < i##_len; i++)
#define rep3(i, a, b) for (int i = (int)(a), i##_len=(b); i >= i##_len; i--)
#define rfor(i, a) for (auto &i: a)
#define all(obj) begin(obj), end(obj)
#define _max(x) *max_element(all(x))
#define _min(x) *min_element(all(x))
#define _sum(x) accumulate(all(x), 0LL)

const int MOD   = 1000000007;
const double INF    = 1e18;
const double EPS = 1e-20;
const double PI  = 3.14159265358979;
template <class T> using V = vector<T>;
template <class T> using VV = vector<vector<T>>;
template <class T> using VVV = vector<vector<vector<T>>>;
template <class T, class S>  using P = pair<T, S>;
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b;return true;}return false;}
template<class T> bool chmin(T &a, const T &b) {if (b < a) {a = b;return true;}return false;}
int _ceil(int a, int b) { return (a >= 0 ? (a + (b - 1)) / b : (a - (b - 1)) / b); }
template<class T> T chmod(T &a, T mod=MOD) {a =  a >= 0 ? a % mod : a - (mod * _ceil(a, mod)); return a;};
int _mod(int a, int mod=MOD) {return a >= 0 ? a % mod : a - (mod * _ceil(a, mod));}
int _pow(int a, int b, int mod=MOD) {int res = 1;for (a %= mod; b; a = a * a % mod, b >>= 1)if (b & 1) res = res * a % mod;return res;}
vector<int> iota(int n){vector<int> ret(n); iota(begin(ret), end(ret), 0); return ret;}
struct mint {long long x;mint(long long x = 0): x((x % MOD + MOD) % MOD) {}mint operator-() const { return mint(-x); }mint &operator+=(const mint a) {if ((x += a.x) >= MOD) x -= MOD;return *this;}mint &operator-=(const mint a) {if ((x += MOD - a.x) >= MOD) x -= MOD;return *this;}mint &operator*=(const mint a) {(x *= a.x) %= MOD;return *this;}mint operator+(const mint a) const { return mint(*this) += a; }mint operator-(const mint a) const { return mint(*this) -= a; }mint operator*(const mint a) const { return mint(*this) *= a; }mint pow(long long n) const {mint ret(1), mul(x);while (n > 0) {if (n & 1) ret *= mul;mul *= mul;n >>= 1;}return ret;}mint inv() const {int a = x, b = MOD, u = 1, v = 0, t;while (b > 0) {t = a / b;swap(a -= t * b, b);swap(u -= t * v, v);}return mint(u);}mint &operator/=(const mint a) { return *this *= a.inv(); }mint operator/(const mint a) const { return mint(*this) /= a; }bool operator==(const mint a) const { return x == a.x; }bool operator!=(const mint a) const { return x != a.x; }friend istream &operator>>(istream &is, mint &a) { return is >> a.x; }friend ostream &operator<<(ostream &os, const mint &a) { return os << a.x; }};
// clang-format on

template<class T> vector<vector<T>> rotate_45_degree(vector<vector<T>> &xy) { // 45度回転
  vector<vector<T>> ret(xy.size(), vector<T>(2));
  for (int i = 0; i < xy.size(); i++) {
    ret[i][0] = xy[i][0] - xy[i][1] == 0 ? 0 : (xy[i][0] - xy[i][1]) / (sqrt(2));
    ret[i][1] = xy[i][0] + xy[i][1] == 0 ? 0 : (xy[i][0] + xy[i][1]) / (sqrt(2));
  }
  return ret;
};
double mod(double a, double b) {
  return fmod(a, b) >= 0 ? fmod(a, b) : fmod(a, b) + b;
}

double calc_max_dis(double x, double y, VV<double> &xy) {
  double ret = 0;
  rfor(i, xy) {
    double temp = abs(i[0] - x) + abs(i[1] - y);
    if (mod(i[1], 10) == 0 and mod(y, 10) == 0 and i[1] != y and (i[0] - mod(i[0], 10)) == (x - mod(x, 10))) {
      temp += 2 * min({mod(i[0], 10), mod(x, 10), 10 - mod(i[0], 10), 10 - mod(x, 10)});
    }
    if (mod(i[0], 10) == 0 and mod(x, 10) == 0 and i[0] != x and (i[1] - mod(i[1], 10)) == (y - mod(y, 10))) {
      temp += 2 * min({mod(i[1], 10), mod(y, 10), 10 - mod(i[1], 10), 10 - mod(y, 10)});
    }
    chmax(ret, temp);
  }
  return ret;
}

signed main() {
  cin.tie(nullptr);
  cout.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  int N;
  cin >> N;
  VV<double> xy(N, V<double>(2));
  rep(i, N) cin >> xy[i][0] >> xy[i][1];
  VV<double> rotated_xy = rotate_45_degree(xy);
  double x_max = -INF, x_min = INF, y_max = -INF, y_min = INF;
  rep(i, N) {
    chmax(x_max, rotated_xy[i][0]);
    chmax(y_max, rotated_xy[i][1]);
    chmin(x_min, rotated_xy[i][0]);
    chmin(y_min, rotated_xy[i][1]);
  }
  double X_rotated   = (x_max + x_min) / 2;
  double Y_rotated   = (y_max + y_min) / 2;
  double X           = (X_rotated + Y_rotated == 0) ? 0 : (X_rotated + Y_rotated) / sqrt(2);
  double Y           = (-X_rotated + Y_rotated == 0) ? 0 : (-X_rotated + Y_rotated) / sqrt(2);
  double minimum_dis = INF;
  for (double y = Y - mod(Y, 10); y <= Y + 10 - mod(Y, 10); y += 1e-1) {
    chmin(minimum_dis, calc_max_dis(X - mod(X, 10), y, xy));
    chmin(minimum_dis, calc_max_dis(X - mod(X, 10) + 10, y, xy));
  }
  for (double x = X - mod(X, 10); x <= X + 10 - mod(X, 10); x += 1e-1) {
    chmin(minimum_dis, calc_max_dis(x, Y - mod(Y, 10), xy));
    chmin(minimum_dis, calc_max_dis(x, Y - mod(Y, 10) + 10, xy));
  }
  cout << minimum_dis << endl;
}
accuracy: 1
time_ms: 1520
memory_kb: 4372
final_rank: 14

code_snippet: // clang-format off
#include <bits/stdc++.h>
//#pragma GCC optimize ("-Ofast")
//#pragma GCC optimize ("unroll-loops")
#define int long long
#define endl '\n'
//#define double __float80
using namespace std;
#define fi first
#define se second
#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; i++)
#define rep2(i, a, b) for (int i = (int)(a), i##_len=(b); i < i##_len; i++)
#define rep3(i, a, b) for (int i = (int)(a), i##_len=(b); i >= i##_len; i--)
#define rfor(i, a) for (auto &i: a)
#define all(obj) begin(obj), end(obj)
#define _max(x) *max_element(all(x))
#define _min(x) *min_element(all(x))
#define _sum(x) accumulate(all(x), 0LL)

const int MOD   = 1000000007;
// const int MOD    = 998244353;
const double INF    = 1e18;
// const int INF    = 1e13 + 7;
const double EPS = 1e-20;
const double PI  = 3.14159265358979;
template <class T> using V = vector<T>;
template <class T> using VV = vector<vector<T>>;
template <class T> using VVV = vector<vector<vector<T>>>;
template <class T, class S>  using P = pair<T, S>;
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b;return true;}return false;}
template<class T> bool chmin(T &a, const T &b) {if (b < a) {a = b;return true;}return false;}
int _ceil(int a, int b) { return (a >= 0 ? (a + (b - 1)) / b : (a - (b - 1)) / b); }
template<class T> T chmod(T &a, T mod=MOD) {a =  a >= 0 ? a % mod : a - (mod * _ceil(a, mod)); return a;};
int _mod(int a, int mod=MOD) {return a >= 0 ? a % mod : a - (mod * _ceil(a, mod));}
int _pow(int a, int b, int mod=MOD) {int res = 1;for (a %= mod; b; a = a * a % mod, b >>= 1)if (b & 1) res = res * a % mod;return res;}
vector<int> iota(int n){vector<int> ret(n); iota(begin(ret), end(ret), 0); return ret;}
struct mint {long long x;mint(long long x = 0): x((x % MOD + MOD) % MOD) {}mint operator-() const { return mint(-x); }mint &operator+=(const mint a) {if ((x += a.x) >= MOD) x -= MOD;return *this;}mint &operator-=(const mint a) {if ((x += MOD - a.x) >= MOD) x -= MOD;return *this;}mint &operator*=(const mint a) {(x *= a.x) %= MOD;return *this;}mint operator+(const mint a) const { return mint(*this) += a; }mint operator-(const mint a) const { return mint(*this) -= a; }mint operator*(const mint a) const { return mint(*this) *= a; }mint pow(long long n) const {mint ret(1), mul(x);while (n > 0) {if (n & 1) ret *= mul;mul *= mul;n >>= 1;}return ret;}mint inv() const {int a = x, b = MOD, u = 1, v = 0, t;while (b > 0) {t = a / b;swap(a -= t * b, b);swap(u -= t * v, v);}return mint(u);}mint &operator/=(const mint a) { return *this *= a.inv(); }mint operator/(const mint a) const { return mint(*this) /= a; }bool operator==(const mint a) const { return x == a.x; }bool operator!=(const mint a) const { return x != a.x; }friend istream &operator>>(istream &is, mint &a) { return is >> a.x; }friend ostream &operator<<(ostream &os, const mint &a) { return os << a.x; }};
// clang-format on

template<class T> vector<vector<T>> rotate_45_degree(vector<vector<T>> &xy) { // 45度回転
  vector<vector<T>> ret(xy.size(), vector<T>(2));
  for (int i = 0; i < xy.size(); i++) {
    ret[i][0] = xy[i][0] - xy[i][1] == 0 ? 0 : (xy[i][0] - xy[i][1]) / (sqrt(2));
    ret[i][1] = xy[i][0] + xy[i][1] == 0 ? 0 : (xy[i][0] + xy[i][1]) / (sqrt(2));
  }
  return ret;
};

double calc_max_dis(double x, double y, VV<double> &xy) {
  double ret = 0;
  rfor(i, xy) {
    double temp = abs(i[0] - x) + abs(i[1] - y);
    if (fmod(i[1], 10) == 0 and fmod(y, 10) == 0 and i[1] != y and (i[0] - fmod(i[0], 10)) == (x - fmod(x, 10))) {
      temp += 2 * min({fmod(i[0], 10), fmod(x, 10), 10 - fmod(i[0], 10), 10 - fmod(x, 10)});
    }
    if (fmod(i[0], 10) == 0 and fmod(x, 10) == 0 and i[0] != x and (i[1] - fmod(i[1], 10)) == (y - fmod(y, 10))) {
      temp += 2 * min({fmod(i[1], 10), fmod(y, 10), 10 - fmod(i[1], 10), 10 - fmod(y, 10)});
    }
    chmax(ret, temp);
  }
  return ret;
}

signed main() {
  cin.tie(nullptr);
  cout.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  int N;
  cin >> N;
  VV<double> xy(N, V<double>(2));
  rep(i, N) cin >> xy[i][0] >> xy[i][1];
  VV<double> rotated_xy = rotate_45_degree(xy);
  double x_max = -INF, x_min = INF, y_max = -INF, y_min = INF;
  rep(i, N) {
    chmax(x_max, rotated_xy[i][0]);
    chmax(y_max, rotated_xy[i][1]);
    chmin(x_min, rotated_xy[i][0]);
    chmin(y_min, rotated_xy[i][1]);
  }
  double X_rotated   = (x_max + x_min) / 2;
  double Y_rotated   = (y_max + y_min) / 2;
  double X           = (X_rotated + Y_rotated == 0) ? 0 : (X_rotated + Y_rotated) / sqrt(2);
  double Y           = (-X_rotated + Y_rotated == 0) ? 0 : (-X_rotated + Y_rotated) / sqrt(2);
  double minimum_dis = INF;
  for (double y = Y - fmod(Y, 10); y <= Y + 10 - fmod(Y, 10); y += 1e-4) {
    if (minimum_dis < 18){
      int k = 0;
    }
    chmin(minimum_dis, calc_max_dis(X - fmod(X, 10), y, xy));
    chmin(minimum_dis, calc_max_dis(X - fmod(X, 10) + 10, y, xy));
  }
  for (double x = X - fmod(X, 10); x <= X + 10 - fmod(X, 10); x += 1e-4) {
    chmin(minimum_dis, calc_max_dis(x, Y - fmod(Y, 10), xy));
    chmin(minimum_dis, calc_max_dis(x, Y - fmod(Y, 10) + 10, xy));
  }
  cout << minimum_dis << endl;
}
accuracy: 0.029850746268656716
time_ms: 50
memory_kb: 3640
final_rank: 19

code_snippet: // clang-format off
#include <bits/stdc++.h>
//#pragma GCC optimize ("-Ofast")
//#pragma GCC optimize ("unroll-loops")
#define int long long
#define endl '\n'
//#define double __float80
using namespace std;
#define fi first
#define se second
#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; i++)
#define rep2(i, a, b) for (int i = (int)(a), i##_len=(b); i < i##_len; i++)
#define rep3(i, a, b) for (int i = (int)(a), i##_len=(b); i >= i##_len; i--)
#define rfor(i, a) for (auto &i: a)
#define all(obj) begin(obj), end(obj)
#define _max(x) *max_element(all(x))
#define _min(x) *min_element(all(x))
#define _sum(x) accumulate(all(x), 0LL)

const int MOD   = 1000000007;
// const int MOD    = 998244353;
const double INF    = 1e18;
// const int INF    = 1e13 + 7;
const double EPS = 1e-20;
const double PI  = 3.14159265358979;
template <class T> using V = vector<T>;
template <class T> using VV = vector<vector<T>>;
template <class T> using VVV = vector<vector<vector<T>>>;
template <class T, class S>  using P = pair<T, S>;
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b;return true;}return false;}
template<class T> bool chmin(T &a, const T &b) {if (b < a) {a = b;return true;}return false;}
int _ceil(int a, int b) { return (a >= 0 ? (a + (b - 1)) / b : (a - (b - 1)) / b); }
template<class T> T chmod(T &a, T mod=MOD) {a =  a >= 0 ? a % mod : a - (mod * _ceil(a, mod)); return a;};
int _mod(int a, int mod=MOD) {return a >= 0 ? a % mod : a - (mod * _ceil(a, mod));}
int _pow(int a, int b, int mod=MOD) {int res = 1;for (a %= mod; b; a = a * a % mod, b >>= 1)if (b & 1) res = res * a % mod;return res;}
vector<int> iota(int n){vector<int> ret(n); iota(begin(ret), end(ret), 0); return ret;}
struct mint {long long x;mint(long long x = 0): x((x % MOD + MOD) % MOD) {}mint operator-() const { return mint(-x); }mint &operator+=(const mint a) {if ((x += a.x) >= MOD) x -= MOD;return *this;}mint &operator-=(const mint a) {if ((x += MOD - a.x) >= MOD) x -= MOD;return *this;}mint &operator*=(const mint a) {(x *= a.x) %= MOD;return *this;}mint operator+(const mint a) const { return mint(*this) += a; }mint operator-(const mint a) const { return mint(*this) -= a; }mint operator*(const mint a) const { return mint(*this) *= a; }mint pow(long long n) const {mint ret(1), mul(x);while (n > 0) {if (n & 1) ret *= mul;mul *= mul;n >>= 1;}return ret;}mint inv() const {int a = x, b = MOD, u = 1, v = 0, t;while (b > 0) {t = a / b;swap(a -= t * b, b);swap(u -= t * v, v);}return mint(u);}mint &operator/=(const mint a) { return *this *= a.inv(); }mint operator/(const mint a) const { return mint(*this) /= a; }bool operator==(const mint a) const { return x == a.x; }bool operator!=(const mint a) const { return x != a.x; }friend istream &operator>>(istream &is, mint &a) { return is >> a.x; }friend ostream &operator<<(ostream &os, const mint &a) { return os << a.x; }};
// clang-format on

template<class T> vector<vector<T>> rotate_45_degree(vector<vector<T>> &xy) { // 45度回転
  vector<vector<T>> ret(xy.size(), vector<T>(2));
  for (int i = 0; i < xy.size(); i++) {
    ret[i][0] = xy[i][0] - xy[i][1] == 0 ? 0 : (xy[i][0] - xy[i][1]) / (sqrt(2));
    ret[i][1] = xy[i][0] + xy[i][1] == 0 ? 0 : (xy[i][0] + xy[i][1]) / (sqrt(2));
  }
  return ret;
};

double calc_max_dis(double x, double y, VV<double> &xy) {
  double ret = 0;
  rfor(i, xy) {
    double temp = abs(i[0] - x) + abs(i[1] - y);
    if (fmod(i[1], 10) == 0 and fmod(y, 10) == 0 and i[1] != y and (i[0] - fmod(i[0], 10)) == (x - fmod(x, 10))) {
      temp += min({fmod(i[0], 10), fmod(x, 10), 10 - fmod(i[0], 10), 10 - fmod(x, 10)});
    }
    if (fmod(i[0], 10) == 0 and fmod(x, 10) == 0 and i[0] != x and (i[1] - fmod(i[1], 10)) == (y - fmod(y, 10))) {
      temp += min({fmod(i[1], 10), fmod(y, 10), 10 - fmod(i[1], 10), 10 - fmod(y, 10)});
    }
    chmax(ret, temp);
  }
  return ret;
}

signed main() {
  cin.tie(nullptr);
  cout.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  int N;
  cin >> N;
  VV<double> xy(N, V<double>(2));
  rep(i, N) cin >> xy[i][0] >> xy[i][1];
  VV<double> rotated_xy = rotate_45_degree(xy);
  double x_max = -INF, x_min = INF, y_max = -INF, y_min = INF;
  rep(i, N) {
    chmax(x_max, rotated_xy[i][0]);
    chmax(y_max, rotated_xy[i][1]);
    chmin(x_min, rotated_xy[i][0]);
    chmin(y_min, rotated_xy[i][1]);
  }
  double X_rotated   = (x_max + x_min) / 2;
  double Y_rotated   = (y_max + y_min) / 2;
  double X           = (X_rotated + Y_rotated == 0) ? 0 : (X_rotated + Y_rotated) / sqrt(2);
  double Y           = (-X_rotated + Y_rotated == 0) ? 0 : (-X_rotated + Y_rotated) / sqrt(2);
  double minimum_dis = INF;
  for (double y = Y - fmod(Y, 10); y <= Y + 10 - fmod(Y, 10); y += 1e-4) {
    chmin(minimum_dis, calc_max_dis(X - fmod(X, 10), y, xy));
    chmin(minimum_dis, calc_max_dis(X - fmod(X, 10) + 10, y, xy));
  }
  for (double x = X - fmod(X, 10); x <= X + 10 - fmod(X, 10); x += 1e-4) {
    if (x >= 7.5){
      int k = 0;
    }
    chmin(minimum_dis, calc_max_dis(x, Y - fmod(Y, 10), xy));
    chmin(minimum_dis, calc_max_dis(x, Y - fmod(Y, 10) + 10, xy));
  }
  cout << minimum_dis << endl;
}
accuracy: 0.014925373134328358
time_ms: 50
memory_kb: 3524
final_rank: 20

code_snippet: #include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    int N; cin >> N;
    vector<int> x(N), y(N);
    rep(i,N) cin >> x[i] >> y[i];
    int D = +1e9, U = -1e9;
    int L = +1e9, R = -1e9;
    rep(i,N) {
        D = min(D, x[i] + y[i]);
        U = max(U, x[i] + y[i]);
        L = min(L, x[i] - y[i]);
        R = max(R, x[i] - y[i]);
    }

    int MidY = (D + U) / 2;
    int MidX = (L + R) / 2;
    int X = (MidY + MidX) / 2;
    int Y = (MidY - MidX) / 2;
    X = X / 10 * 10;
    Y = Y / 10 * 10;

    auto f = [&](double x1, double y1, double x2, double y2) {
        // (x1, y1) と (x2, y2) の距離
        if(floor(y1 / 10) == floor(y2 / 10)) swap(x1, y1), swap(x2, y2);
        if(floor(x1 / 10) == floor(x2 / 10)) {
            if(y1 == y2) return abs(x1 - x2);
            x1 -= floor(x1 / 10) * 10;
            x2 -= floor(x2 / 10) * 10;
            return min(x1 + x2, 20 - (x1 + x2)) + abs(y1 - y2);
        }
        return abs(x1 - x2) + abs(y1 - y2);
    };

    double ans = 1e9;
    int range = 100;
    for(int tx = X - range / 2; tx <= X + range / 2; tx += 10) {
        for(double ty = Y - range / 2; ty <= Y + range / 2; ty += 0.5) {
            double ma = 0;
            rep(i,N) ma = max(ma, f(x[i], y[i], tx, ty));
            ans = min(ans, ma);
        }
    }
    
    for(double tx = X - range / 2; tx <= X + range / 2; tx += 0.5) {
        for(int ty = Y - range / 2; ty <= Y + range / 2; ty += 10) {
            double ma = 0;
            rep(i,N) ma = max(ma, f(x[i], y[i], tx, ty));
            ans = min(ans, ma);
        }
    }

    printf("%.5f\n",ans);
}
accuracy: 1
time_ms: 310
memory_kb: 3644
final_rank: 9

code_snippet: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);
//const ll mod = 1000000007;
ll N;
ll X[10500], Y[10500];
ll ans = INF;
ll x[2][2], y[2][2];

ll dist(vector<ll> X, vector<ll> Y) {
    if(X[0] == X[1] and (X[0] % 20 == 0)) return abs(Y[0] - Y[1]);
    if(Y[0] == Y[1] and (Y[0] % 20 == 0)) return abs(X[0] - X[1]);
    for(int i = 0; i < 2; i++) {
        if(X[i] % 20 == 0) {
            x[i][0] = X[i];
            x[i][1] = X[i];
            y[i][0] = Y[i] / 20 * 20;
            y[i][1] = y[i][0] + 20;
        } else {
            x[i][0] = X[i] / 20 * 20;
            x[i][1] = x[i][0] + 20;
            y[i][0] = Y[i];
            y[i][1] = Y[i];
        }
        assert(x[i][0] % 20 == 0 or y[i][0] % 20 == 0);
    }
    ll ret = INF;
    for(int i = 0; i < 2; i++) {
        for(int j = 0; j < 2; j++) {
            ll tmp = 0;
            tmp += abs(X[0] - x[0][i]);
            tmp += abs(Y[0] - y[0][i]);
            tmp += abs(x[0][i] - x[1][j]);
            tmp += abs(y[0][i] - y[1][j]);
            tmp += abs(x[1][j] - X[1]);
            tmp += abs(y[1][j] - Y[1]);
            chmin(ret, tmp);
        }
    }
    return ret;
}

void f(ll x, ll y) {
    ll tmp = 0;
    for(ll i = 0; i < N; i++) {
        ll disttmp = dist({x, X[i]}, {y, Y[i]});
        chmax(tmp, disttmp);
    }
    chmin(ans, tmp);
}

int main() {
    cin >> N;
    ll Xsum = 0;
    ll Ysum = 0;
    for(int i = 0; i < N; i++) {
        cin >> X[i] >> Y[i];
        X[i] += 200000000;
        Y[i] += 200000000;
        X[i] *= 2;
        Y[i] *= 2;
        Xsum += X[i];
        Ysum += Y[i];
    }
    ll Xave = Xsum / N;
    ll Yave = Ysum / N;
    for(ll x = Xave - 1000; x <= Xave + 1000; x++) {
        assert(x >= 0);
        for(ll y = Yave - 1000; y <= Yave + 1000; y++) {
            assert(y >= 0);
            if(x % 20 != 0 and y % 20 != 0) continue;
            f(x, y);
        }
    }
    cout << fixed << setprecision(30) << (double)(ans) / 2.0 << endl;
    return 0;
}
accuracy: 0.26865671641791045
time_ms: 130
memory_kb: 3304
final_rank: 18

code_snippet: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);
//const ll mod = 1000000007;
ll N;
ll X[10500], Y[10500];
ll ans = INF;
ll x[2][2], y[2][2];

ll dist(vector<ll> X, vector<ll> Y) {
    if(X[0] == X[1] and (X[0] % 20 == 0)) return abs(Y[0] - Y[1]);
    if(Y[0] == Y[1] and (Y[0] % 20 == 0)) return abs(X[0] - X[1]);
    for(int i = 0; i < 2; i++) {
        if(X[i] % 20 == 0) {
            x[i][0] = X[i];
            x[i][1] = X[i];
            y[i][0] = Y[i] / 20 * 20;
            y[i][1] = y[i][0] + 20;
        } else {
            x[i][0] = X[i] / 20 * 20;
            x[i][1] = x[i][0] + 20;
            y[i][0] = Y[i];
            y[i][1] = Y[i];
        }
        assert(x[i][0] % 20 == 0 or y[i][0] % 20 == 0);
    }
    ll ret = INF;
    for(int i = 0; i < 2; i++) {
        for(int j = 0; j < 2; j++) {
            ll tmp = 0;
            tmp += abs(X[0] - x[0][i]);
            tmp += abs(Y[0] - y[0][i]);
            tmp += abs(x[0][i] - x[1][j]);
            tmp += abs(y[0][i] - y[1][j]);
            tmp += abs(x[1][j] - X[1]);
            tmp += abs(y[1][j] - Y[1]);
            chmin(ret, tmp);
        }
    }
    return ret;
}

void f(ll x, ll y) {
    ll tmp = 0;
    for(ll i = 0; i < N; i++) {
        ll disttmp = dist({x, X[i]}, {y, Y[i]});
        chmax(tmp, disttmp);
    }
    chmin(ans, tmp);
}

int main() {
    cin >> N;
    ll Xsum = 0;
    ll Ysum = 0;
    for(int i = 0; i < N; i++) {
        cin >> X[i] >> Y[i];
        X[i] += 2e8;
        Y[i] += 2e8;
        X[i] *= 2;
        Y[i] *= 2;
        Xsum += X[i];
        Ysum += Y[i];
    }
    ll Xave = Xsum / N;
    ll Yave = Ysum / N;
    for(ll x = Xave - 400; x <= Xave + 400; x++) {
        assert(x >= 0);
        for(ll y = Yave - 400; y <= Yave + 400; y++) {
            assert(y >= 0);
            if(x % 20 != 0 and y % 20 != 0) continue;
            f(x, y);
        }
    }
    cout << fixed << setprecision(30) << (double)(ans) / 2.0 << endl;
    return 0;
}
accuracy: 0.26865671641791045
time_ms: 20
memory_kb: 3304
final_rank: 17

code_snippet: #include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-9;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;


int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	cin >> N;
	vector<int>x(N);
	vector<int>y(N);
	int xl = MOD, xr = -MOD, yl = MOD, yr = -MOD;
	for (int i = 0; i < N; i++) {
		cin >> x[i] >> y[i];
		x[i] <<= 1, y[i] <<= 1;
		x[i] += 400000000;
		y[i] += 100000000;
		int X, Y;
		tie(X, Y) = make_pair(x[i] + y[i], x[i] - y[i]);
		xl = min(xl, X);
		xr = max(xr, X);
		yl = min(yl, Y);
		yr = max(yr, Y);
		
	}
	int xmid = (xl + xr) / 2;
	int ymid = (yl + yr) / 2;
	int ans = MOD;
	int len = 100;
	for (int i = xmid - len; i <= xmid + len; i++) {
		for (int j = ymid - len; j <= ymid + len; j++) {
			if (abs(i - j) % 2)continue;
			int w = (i + j) / 2;
			int h = i - w;
			if (w % 20 && h % 20)continue;
			int box = 0;
			for (int k = 0; k < N; k++) {
				if ((w+1000000000) / 20 == (x[k]+1000000000) / 20) {
					if (h == y[k])box = max(box, abs(w - x[k]));
					else box = max(box, abs(h - y[k]) + min(40 - (w % 20 + x[k] % 20), (w % 20 + x[k] % 20)));
				}
				else if ((h+1000000000) / 20 == (y[k]+1000000000) / 20) {
					if (w == x[k])box = max(box, abs(h - y[k]));
					else box = max(box, abs(w - x[k]) + min(40 - (h % 20 + y[k] % 20), (h % 20 + y[k] % 20)));
				}
				else {
					box = max(box, abs(h - y[k]) + abs(w - x[k]));
				}
			}
			//cout << w << " " << h << " " << box << endl;
			ans = min(ans, box);
		}
	}
	cout << ans / 2;
	if (ans & 1)cout << "." << 5;
	cout << endl;
}
accuracy: 1
time_ms: 50
memory_kb: 3272
final_rank: 1

code_snippet: #include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <numeric>
#include <queue>
#include <map>
#include <math.h>
using namespace std;
typedef long long int ll;

double dist(double a,double b,double c,double d){
	if(floor(b/10)==floor(d/10)){
		swap(a,b); swap(c,d);
	}
	if(floor(a/10)==floor(c/10)){
		if(b==d)return abs(a-c);
		a-=floor(a/10)*10,c-=floor(c/10)*10;
		return abs(b-d)+min(a+c,20-a-c);
	}
	return abs(a-c)+abs(b-d);
}

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n; cin >> n;
	vector<int> x(n),y(n);
	int xi=1e9,xa=-1e9;
	int yi=1e9,ya=-1e9;
	for(int i=0;i<n;i++){
		cin >> x[i] >> y[i];
		xi=min(xi,x[i]+y[i]);
		xa=max(xa,x[i]+y[i]);
		yi=min(yi,x[i]-y[i]);
		ya=max(ya,x[i]-y[i]);
	}
	double res=1e9;
	xi=(xi+xa)/2,yi=(yi+ya)/2;
	int xx=(xi+yi)/2,yy=(xi-yi)/2;
	xx-=xx%10,yy-=yy%10;
	for(int X=xx-50;X<=xx+50;X+=10){
		for(double Y=yy-50;Y<=yy+50;Y+=0.5){
			double d=0;
			for(int i=0;i<n;i++){
				d=max(d,dist(x[i],y[i],X,Y));
			}
			res=min(res,d);
		}
	}
	for(int Y=yy-30;Y<=yy+30;Y+=10){
		for(double X=xx-30;X<=xx+30;X+=0.5){
			double d=0;
			for(int i=0;i<n;i++){
				d=max(d,dist(x[i],y[i],X,Y));
			}
			res=min(res,d);
		}
	}
	printf("%.9f\n",res);
}
accuracy: 1
time_ms: 420
memory_kb: 3336
final_rank: 5