結果

問題 No.3042 拡大コピー
ユーザー Iroha_3856
提出日時 2025-02-28 21:34:56
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 420 ms / 2,000 ms
コード長 884 bytes
コンパイル時間 3,506 ms
コンパイル使用メモリ 277,732 KB
実行使用メモリ 25,352 KB
最終ジャッジ日時 2025-03-01 07:37:57
合計ジャッジ時間 5,803 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define rep(i, l, r) for (int i = (int)(l); i<(int)(r); i++)
#define ll long long

long double getdist(vector<pair<long double, long double>> G) {
    int N = (int)G.size();
    pair<long double, long double> g;
    rep(i, 0, N) {
        g.first += G[i].first;
        g.second += G[i].second;
    }
    g.first /= N; g.second /= N;
    long double ret = 0;
    rep(i, 0, N) {
        ret = max(ret, hypot(g.first-G[i].first, g.second-G[i].second));
    }
    return ret;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N; cin >> N;
    vector<pair<long double, long double>> A(N), B(N);
    rep(i, 0, N) cin >> A[i].first >> A[i].second;
    rep(i, 0, N) cin >> B[i].first >> B[i].second;
    long double resa = getdist(A), resb = getdist(B);
    cout << fixed << setprecision(15) << resb/resa << endl;
}
0