194 lines
4.0 KiB
C++
194 lines
4.0 KiB
C++
/* Problem URL: https://codeforces.com/gym/105231/problem/I */
|
|
|
|
#include <bits/stdc++.h>
|
|
|
|
#pragma GCC optimize("Ofast")
|
|
#pragma GCC optimize("unroll-loops")
|
|
#pragma GCC target("avx2")
|
|
#pragma GCC target("bmi,bmi2,popcnt,lzcnt")
|
|
|
|
using namespace std;
|
|
|
|
#define V vector
|
|
|
|
#define rmin(a, b) a = min(a, b)
|
|
#define rmax(a, b) a = max(a, b)
|
|
|
|
#define rep(i, lim) for (int i = 0; i < (lim); i++)
|
|
#define nrep(i, s, lim) for (int i = s; i < (lim); i++)
|
|
|
|
#define repv(i, v) for (auto &i : (v))
|
|
#define fillv(v) for (auto &itr_ : (v)) { cin >> itr_; }
|
|
#define sortv(v) sort(v.begin(), v.end())
|
|
#define all(v) (v).begin(), (v).end()
|
|
|
|
using vi = vector<int>;
|
|
using vvi = vector<vi>;
|
|
using vvvi = vector<vvi>;
|
|
using vvvvi = vector<vvvi>;
|
|
|
|
using ll = long long;
|
|
|
|
using vl = vector<ll>;
|
|
using vvl = vector<vl>;
|
|
using vvvl = vector<vvl>;
|
|
using vvvvl = vector<vvvl>;
|
|
|
|
template<class v>
|
|
auto operator<<(ostream &os, const vector<v> &vec)->ostream& {
|
|
os << vec[0];
|
|
for (size_t i = 1; i < vec.size(); i++) {
|
|
os << ' ' << vec[i];
|
|
}
|
|
os << '\n';
|
|
return os;
|
|
}
|
|
|
|
template<class v>
|
|
auto operator>>(istream &is, vector<v> &vec)->istream& {
|
|
for (auto &i : vec) {
|
|
is >> i;
|
|
}
|
|
return is;
|
|
}
|
|
|
|
template<class v>
|
|
auto operator<<(ostream &os, const vector<vector<v>> &vec)->ostream& {
|
|
for (auto &i : vec) {
|
|
os << i[0];
|
|
for (size_t j = 1; j < i.size(); j++) {
|
|
os << ' ' << i[j];
|
|
}
|
|
os << '\n';
|
|
}
|
|
return os;
|
|
}
|
|
|
|
template<class v>
|
|
auto operator>>(istream &is, vector<vector<v>> &vec)->istream& {
|
|
for (auto &i : vec) {
|
|
for (auto &j : i) {
|
|
is >> j;
|
|
}
|
|
}
|
|
return is;
|
|
}
|
|
using pd = pair<double, double>;
|
|
|
|
pd operator+(pd a, pd b) {
|
|
pd fds = {a.first + b.first, a.second + b.second};
|
|
return fds;
|
|
}
|
|
|
|
pd operator-(pd a, pd b) {
|
|
pd fds = {a.first - b.first, a.second - b.second};
|
|
return fds;
|
|
}
|
|
|
|
pd operator/(pd a, double f) {
|
|
return make_pair(a.first / f, a.second / f);
|
|
}
|
|
|
|
pd operator*(pd a, double f) {
|
|
return make_pair(a.first * f, a.second * f);
|
|
}
|
|
|
|
pd rotate90(pd a) {
|
|
return pd(-a.second, a.first);
|
|
}
|
|
|
|
double operator^(pd a, pd b) {
|
|
return a.first * b.second - a.second * b.first;
|
|
}
|
|
|
|
struct line {
|
|
pd p, q;
|
|
};
|
|
|
|
double get_t(pd v, line r) {
|
|
return (r.p^r.q) / ((r.p - r.q)^v);
|
|
}
|
|
|
|
double EPS = 1e-6;
|
|
double inf = 1e18;
|
|
pd inter(line r, line s)
|
|
{
|
|
if (abs((r.p - r.q) ^ (s.p - s.q)) < EPS) {
|
|
return pd(inf, inf);
|
|
}
|
|
|
|
r.q = r.q - r.p, s.p = s.p - r.p, s.q = s.q - r.p;
|
|
return (r.q * get_t(r.q, s)) + r.p;
|
|
}
|
|
|
|
pd getcenter(pd a, pd b, pd c) {
|
|
b = (a + b) / 2;
|
|
c = (a + c) / 2;
|
|
return inter(line(b, b + rotate90(a - b)), line(c, c + rotate90(a - c)));
|
|
}
|
|
|
|
int main()
|
|
{
|
|
ios::sync_with_stdio(false);
|
|
cin.tie(nullptr);
|
|
|
|
int n;
|
|
cin >> n;
|
|
|
|
V<pair<double, double>> points(n);
|
|
|
|
repv(i, points) {
|
|
cin >> i.first >> i.second;
|
|
}
|
|
|
|
V<double> disses(n, 1e16);
|
|
|
|
auto dis = [&](pair<double, double> &a, pair<double, double> &b) {
|
|
double x = a.first - b.first;
|
|
double y = a.second - b.second;
|
|
return sqrt(x * x + y * y);
|
|
};
|
|
|
|
V<double> lol(n);
|
|
|
|
auto calc = [&](pair<double, double> center) {
|
|
rep(i, n) {
|
|
lol[i] = dis(center, points[i]);
|
|
}
|
|
};
|
|
|
|
auto search = [&](pair<double, double> point) {
|
|
sortv(lol);
|
|
|
|
nrep(i, 1, n) {
|
|
rmin(disses[i], lol[i]);
|
|
}
|
|
};
|
|
|
|
rep(i, n - 1) {
|
|
nrep(j, i + 1, n) {
|
|
pair<double, double> center = {(points[i].first + points[j].first) / 2, (points[i].second + points[j].second) / 2};
|
|
calc(center);
|
|
search(center);
|
|
}
|
|
}
|
|
|
|
rep(i, n - 2) {
|
|
nrep(j, i + 1, n - 1) {
|
|
nrep(k, j + 1, n) {
|
|
auto center = getcenter(points[i], points[j], points[k]);
|
|
calc(center);
|
|
search(center);
|
|
}
|
|
}
|
|
}
|
|
|
|
int act = 1;
|
|
nrep(i, 1, n) {
|
|
rep(j, act) {
|
|
cout << fixed << setprecision(8) << disses[i] << '\n';
|
|
}
|
|
act++;
|
|
}
|
|
}
|