結果

問題 No.178 美しいWhitespace (1)
コンテスト
ユーザー cra77756176
提出日時 2022-12-09 01:37:43
言語 Rust
(1.94.0 + proconio + num + itertools)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 526 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 835 ms
コンパイル使用メモリ 187,616 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-05-02 04:30:44
合計ジャッジ時間 2,219 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

fn main() {
    let mut xx = String::new();
    std::io::Read::read_to_string(&mut std::io::stdin(), &mut xx).ok();
    let xx: Vec<u64> = xx.split_whitespace().skip(1).flat_map(str::parse).collect();

    let len: Vec<u64> = xx.chunks(2).map(|ab| ab[0] + 4 * ab[1]).collect();

    if len.iter().any(|l| l % 2 != len[0] % 2) {
        println!("-1");
    } else {
        let max_len = len.iter().max().unwrap();
        let answer: u64 = len.iter().map(|l| (max_len - l) / 2).sum();

        println!("{}", answer);
    }
}
0