結果

問題 No.410 出会い
コンテスト
ユーザー elphe
提出日時 2026-02-08 11:35:00
言語 Rust
(1.93.0 + proconio + num + itertools)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 703 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,354 ms
コンパイル使用メモリ 198,180 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2026-02-08 11:35:26
合計ジャッジ時間 3,241 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

fn main() {
    let stdin = std::io::read_to_string(std::io::stdin()).unwrap();
    let mut stdin = stdin.split_ascii_whitespace();

    let p: (i32, i32) = (
        stdin.next().unwrap().parse().unwrap(),
        stdin.next().unwrap().parse().unwrap(),
    );
    let q: (i32, i32) = (
        stdin.next().unwrap().parse().unwrap(),
        stdin.next().unwrap().parse().unwrap(),
    );

    println!("{}", output(solve(p, q)));
}

fn solve(p: (i32, i32), q: (i32, i32)) -> u32 {
    p.0.abs_diff(q.0) + p.1.abs_diff(q.1)
}

fn output(ans: u32) -> String {
    (ans >> 1).to_string()
        + match ans & 1 {
            0 => "",
            1 => ".5",
            _ => unreachable!(),
        }
}
0