#include #include using namespace std; using namespace atcoder; #define rep(i, n) for(int i=0;i<(n);++i) #define rep1(i, n) for(int i=1;i<=(n);i++) #define ll long long using mint = modint998244353; using P = pair; using lb = long double; using T = tuple; #ifdef LOCAL # include # define dbg(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__) #else # define dbg(...) (static_cast(0)) #endif // Coodinate Compression // https://youtu.be/fR3W5IcBGLQ?t=8550 template struct CC { bool initialized; vector xs; CC(): initialized(false) {} void add(T x) { xs.push_back(x);} void init() { sort(xs.begin(), xs.end()); xs.erase(unique(xs.begin(),xs.end()),xs.end()); initialized = true; } int operator()(T x) { if (!initialized) init(); return upper_bound(xs.begin(), xs.end(), x) - xs.begin() - 1; } T operator[](int i) { if (!initialized) init(); return xs[i]; } int size() { if (!initialized) init(); return xs.size(); } }; int main() { ll n; cin >> n; vector> vs(n); rep(i,n) cin >> vs[i].first >> vs[i].second; sort(vs.begin(),vs.end()); CC cx, cy; rep(i,n) cy.add(vs[i].second); int sy = cy.size(); fenwick_tree bit(sy); ll p = 0; ll q = 0; for(int i=0;i y; while(j x, y; ll r = n * (n-1)/2; ll s = n * (n-1)/2; rep(i,n) x[vs[i].first]++; rep(i,n) y[vs[i].second]++; for(auto p : x) { r -= (ll)p.second*(p.second-1)/2; } for(auto p : y) { s -= (ll)p.second*(p.second-1)/2; } dbg(p,q,r,s); lb ans = (p-q) / sqrt(r*s); cout << fixed << setprecision(16) << ans << endl; return 0; }