結果

問題 No.3042 拡大コピー
ユーザー nebocco
提出日時 2025-03-14 11:18:47
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 115 ms / 2,000 ms
コード長 858 bytes
コンパイル時間 12,058 ms
コンパイル使用メモリ 401,008 KB
実行使用メモリ 26,188 KB
最終ジャッジ日時 2025-03-14 11:19:03
合計ジャッジ時間 14,971 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#![allow(dead_code, unused_imports, unused_macros, non_snake_case)]
use proconio::{
    input, input_interactive,
    marker::{Bytes, Chars, Usize1},
};

fn main() {
    input! {
        n: usize,
        before: [(f64, f64); n],
        after: [(f64, f64); n],
    }

    let bg = before.iter().fold((0.0, 0.0), |(x, y), &(a, b)| {
        (x + a / n as f64, y + b / n as f64)
    });
    let ag = after.iter().fold((0.0, 0.0), |(x, y), &(a, b)| {
        (x + a / n as f64, y + b / n as f64)
    });

    let bmaxd = before
        .iter()
        .map(|&(a, b)| (a - bg.0).hypot(b - bg.1))
        .max_by(|a, b| a.partial_cmp(b).unwrap())
        .unwrap();
    let amaxd = after
        .iter()
        .map(|&(a, b)| (a - ag.0).hypot(b - ag.1))
        .max_by(|a, b| a.partial_cmp(b).unwrap())
        .unwrap();

    println!("{}", amaxd / bmaxd);
}
0