結果

問題 No.3042 拡大コピー
ユーザー otoshigo
提出日時 2025-02-28 22:39:11
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 467 ms / 2,000 ms
コード長 1,253 bytes
コンパイル時間 2,274 ms
コンパイル使用メモリ 203,704 KB
実行使用メモリ 27,764 KB
最終ジャッジ日時 2025-03-01 07:39:36
合計ジャッジ時間 4,362 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
template<class T> bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;}
template<class T> bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;}

long double dist(long double a,long double b,long double c,long double d){
    return sqrt((a-c)*(a-c)+(b-d)*(b-d));
}

void Solve(){
    int N;
    cin>>N;
    vector<long double>X(N),Y(N);
    for(int i=0;i<N;i++)cin>>X[i]>>Y[i];
    vector<long double>Z(N),W(N);
    for(int i=0;i<N;i++)cin>>Z[i]>>W[i];
    long double px=0,py=0;
    for(int i=0;i<N;i++){
        px+=X[i];
        py+=Y[i];
    }
    px/=N;
    py/=N;
    vector<long double>A;
    for(int i=0;i<N;i++){
        A.push_back(dist(X[i],Y[i],px,py));
    }
    sort(all(A));
    long double pz=0,pw=0;
    for(int i=0;i<N;i++){
        pz+=Z[i];
        pw+=W[i];
    }
    pz/=N;
    pw/=N;
    vector<long double>B;
    for(int i=0;i<N;i++){
        B.push_back(dist(Z[i],W[i],pz,pw));
    }
    sort(all(B));
    cout<<B.back()/A.back()<<"\n";
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout<<fixed<<setprecision(15);
    Solve();
}
0