結果
問題 |
No.3042 拡大コピー
|
ユーザー |
|
提出日時 | 2025-02-28 23:02:52 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,197 bytes |
コンパイル時間 | 12,760 ms |
コンパイル使用メモリ | 401,012 KB |
実行使用メモリ | 32,980 KB |
最終ジャッジ日時 | 2025-03-01 07:40:57 |
合計ジャッジ時間 | 13,708 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 1 WA * 23 |
ソースコード
use proconio::input; type Coord = (f64, f64); const MAX_COORD: f64 = 1e9; fn main() { input! { n: usize, xy: [(f64, f64); n], zw: [(f64, f64); n], } let rotated_xy = to_rotated(&xy); let rotated_zw = to_rotated(&zw); let max_dist_xy = calc_max_dist(&rotated_xy); let max_dist_zw = calc_max_dist(&rotated_zw); println!("{}", max_dist_zw / max_dist_xy); } fn calc_rotated_coord(coord: Coord) -> Coord { (coord.0 - coord.1, coord.0 + coord.1) } fn to_rotated(coords: &[Coord]) -> Vec<Coord> { coords.iter().cloned().map(calc_rotated_coord).collect() } fn calc_max_dist(coords: &[Coord]) -> f64 { let (mut min_x, mut max_x, mut min_y, mut max_y) = (MAX_COORD, 0.0_f64, MAX_COORD, 0.0_f64); for &(x, y) in coords { min_x = min_x.min(x); max_x = max_x.max(x); min_y = min_y.min(y); max_y = max_y.max(y); } let mut max_dist = 0.0_f64; for &(x, y) in coords { let dist = *[x - min_x, max_x - x, y - min_y, max_y - y] .iter() .max_by(|x, y| x.partial_cmp(y).unwrap()) .unwrap(); max_dist = max_dist.max(dist); } max_dist }